Understanding Exceptions within For Loops

Hi All,

Just trying to understand how to use exceptions within For each loops.

My Problem:
I have a For each that goes through an excel, if something is wrong, I use a Exception within the catch to stop this instance and continue with the next item in the loop…correct?
If an error happens, I want to process to halt at that point and continue to this next item in the loop.
But at the moment the whole process stops and flags the error instead of continuing

I’ve included a sample of the structure I have at the moment…what is wrong with it? Why wont it continue to the next loop item?

PS - I excluded the details from the attached sample so there will be validation errors - i’ve included it for structure purposes

trycatchsample.xaml (9.4 KB)

Throwing an exception will make the program halt execution, going to the point where the exception is caught. If you want the loop to continue after an exception you should put your try/catch inside the loop and handle the exception during the operation of the loop.

1 Like

If you want to run the workflow even if you got an error
In property panel select on “continue on error” property set the true value.

Thanks, that’s exactly what I needed - I hadnt quite understood try/catch until now

1 Like

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