Try and Catch doesn't work as expected?


I use switch activity and inside it a try and catch to invoke a workflow file and catch any exception if occurs. However try and catch won’t catch the exception. Run main.xaml to see for yourself. (3.5 KB)

Can anyone tell me what’s wrong with my approach? Or whether this is intended?


May I know what exceptions did you defined in Catch block ?

And also What error are you getting here ? Could you please tell more details about the issue for better understanding.


Sure, i get selector exception(“RemoteException wrapping UiPath.Core.SelectorNotFoundException”) because uipath can’t find the browser to attach. I use a system.exception in try&catch to cover all kinds of exceptions yet it doesn’t catch it.

The zip file actually contains a 1:1 reproduction, can you please look into it? It should log “exception caught” but it doesn’t.


Everything looks correct only and Catch block should catch that exception.

Could you please run the workflow in debug mode and check it once.

1 Like

@Benoni - It is working fine for me. Use Run File rather than directly click on the Debug.

1 Like

Aha, got it. Thanks @anmolk171. It works as expected, in debug mode it stops before executing the catch i guess.

1 Like

@Benoni - In debug mode it will stop the execution right away once the exception will hit.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.