Custom exception not catching

Hello All,

I have a try catch block. In try block I want to throw an exception when a logic breaks. So I used throw activity for throwing error.

In catch block, I have catched the exception by using system.exception.

But when I run the solution. Run time error is shown but it is not going to catch block.

Please provide solution for this

@Ashok98 please give us error screenshot

Hello @Ashok98

You need to declare the catch based on the exception that you are getting. Can you share the exception that you are getting.

and if possible the Try catch activity that you have created.

Thanks

@Ashok98

In try catch use thrown activity for custom exception message it will throw the message then after it won’t go to catch block, Check your flow again

Thanks
Varun

This is the error I throw

I have declared system.exception only

Hi @Ashok98

Can you confirm if this how your try catch looks?

image

catch
image

IS the runtime error showing the same message you used in throw activity?

cheers

Hello @Ashok98
Tried the same flow and its working for me. Please run in debug mode and see how the flow is happening.

image

Thanks

@Rahul_Unnikrishnan

The above image which you shared that is correct, As You given the customized message it is populated

Let me know if you any query

Thanks
Varun

The problem was I had the try catch inside a workflow so it was catching. The I surrounded the workflow with try catch , then exception got caught