Not able to execute the code in Catch block

Hello Everyone,

Need you help understanding the behavior of Try Catch. I have gone through various similar articles and videos. I am facing the same problem where catch block is not executing when there is an error in Try block. Instead flow is going to Global exception handler.

Global exception handler has continue argument so that my workflow is not aborted.
I have sequence of activities in my Try Block. If I get error in any of the activity, my catch block should trigger.

My application is very slow and getting exceptions like missing UI Element is very frequent. Since I know the behavior, I want to handle this in the code. In Catch Block I am closing the application and restarting the workflow again.

I have tried running in normal mode as well. But catch block is not executing.
Exception captured in the catch block system.exception.

Kindly help. Thank you.

Honestly, i would just remove the global handler. I know it’s not the solution you’re looking for but it will reduce a lot of headaches/unintended behavior. Better to do exception handling and logic flow in your code, instead of relying on the global handler.

I want to understand the behavior of Try Catch with Global solution handler. As I am not seeing the expected one based on the various solution provided on the this forum.

Still waiting for someone who can help me with my problem.

Hi,

The following is a simple sample try-catch with GH. When exception occurs, first it runs in GH, next runs in catches,

Is there any difference from this in your workflow?

Sample20210511-1.zip (4.2 KB)

Regards,

1 Like

In my workflow, Try has sequence of activity to navigate through a web application in IE. I am keep getting Missing UI element exception in one of those activity due to unstable application. As soon as I receive the exception, workflow goes to GH and try 3 attempts. As this exception is related to missing UI element, in any of the retry, its not finding the right element to proceed further in Try block activities.

I have ErrorAction.Continue in my GH.

Thereafter my workflow never comes back to catch block to capture the system exception and start the workflow from starting.

Hi,

Can you share your workflow, if possible? It’s no problem even if simple reproduction workflow.

Regards,