How to continue loop after catching exception in try catch activity

hey @nsl1006

As you are saying that you are using try catch within a for each scope and you wants to continue your loop even any exception will occur.

So if you are still using the try catch within the loop scope it will always run that even exception will occur. it is upto you how you deal with exception in your way. So in your case you are also handling exception by using flags.

For example purpose:

for (int i = 0; i < 10; i++)
{
try
{
if (i == 2 || i == 4)
{
throw new Exception("Test " + i);
}
}
catch (Exception ex)
{
// generate a log and flag set.
}
}

here I am attaching a demo sample artifact for your understanding. just see the logic.

trycatchsample.xaml (9.2 KB)

**Note: It is not mandatory to add code in finally block. you should add only code within this scope when you wants to execute those instructions anyhow if exception will occure or not".

For try-catch understanding you can visit this link as well

Let me know the feedback on this :slight_smile:

Regards…!!

4 Likes