Exception thrown from try block getting caught in Global Handler instead Catch block


I’m using Try-Catch block and Global Exception Handler in same project.
I have added Try catch block within For Each loop and in Catch block I have added continue activity so that it can skip current iteration and continue to next.

But, exception thrown is getting caught by Global Handler however Catch block should catch it.

If I remove Global Exception Handler it is working as expected.

Please advise how can it can be resolved.

Studio Version: Community Edition 22.4.4

" The Global Exception Handler is a type of workflow designed to determine the project’s behavior when encountering an execution error."
one approach is to check the error info in the global handler and incase it suits your conditions - use continue so the exception will be thrown back to its sub handlers - in your case the try and catch you defined

1 Like

Thanks a lot, it worked.

Just to Confirm Global Handler behavior:
All the exception will be caught by Global Handler regardless of Try-Catch blocks, if it’s re-thrown from global hander then only it’ll be caught by respective Catch block.

Please correct if above statement is wrong

not exactly, it depends on what kind of exception your ‘try-catch’ block catches.
keep in mind that the global handler catches the system.exception class instances
so if your ‘try-catch’ block catches system.exception then the exception won’t reach the global exception handler because the system.exception was already been taken care of.
but if it catches another kind of exception for instance system.argument exception then the exception will be taken care of by both ‘try-catch’ block and global handler.
(because system.argument exception is a sub class of the system.exception class and sub classes inherits their master class methods…)
read more about inheritance and override methods in oop if you are interested :grinning:

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