Try Catch is not catching an InvalidCastException

I am currently working on Practice 3 in the Orchestrator for RPA Developers lesson on UIPath Academy. One part of the exercise instructs you to create a Try Catch statement that is designed to catch faulty inputs that cannot be converted into integers; you can find the Try Catch I made above. The problem here is that, when the program tries to convert a faulty input to an integer, the program creates a normal exception rather than using the Catch that I made. Because the program never Catches properly, any invalid input forces the user to press the ‘continue’ button themselves, which won’t work for an unattended robot. Note that this is happening in spite of the fact that the Catch is set to InvalidCastException, which should be what the error above qualifies as. What should I do to get my Catch statement working?


It seems matter of debug mode. For now, can you try to turn on “Continue on Exception” in ribbon menu -debug tab?

Or just run (not debug)


1 Like

Hello @Jack_Moran

Here you received this error from the sequence in the Try section. If you run it from Design tab or from debug you can to choose Run file to run it properly.

Else as Yoichi suggested You can enable Continue on Exception, then process will continue and you can see the exception get captured in catch block.

1 Like

@Yoichi @Rahul_Unnikrishnan Running the file without debugging worked! I never knew that debugging changed anything about the way a program ran, but sure enough, my Try Catch now works without the user needing to manually continue the program. Thanks!

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