How to handle multiple unknown errors in foreach loop

Hi All,

Need a help to handle multiple unknown errors and continue foreach loop


1 Like

Welcome back to uipath community
May I know what we’re those errors
Did we try with TRY CATCH activity where place the loop inside the TRY block and choose the system.Exception in catch block so that those exceptions will be caught
Cheers @sowmiyan

Currently I captured submit button if no response in try catch block. Other issues like page not response, loading occurs, and some other activities also fails. Due to this, unable to recognise next step in the workflow and aborts. Any option there to handle this? And continue the foreach loop.

Hi @Palaniyappan

If you have a lot of different errors in a loop that may require you to restart and recover, then you are probably better using something like the robotic enterprise framework. You can do it within a foreach loop too though, but it may start looking a little ugly :slight_smile:
If your errors result in different exceptions, then you can handle it with a Try Catch, with a different flow to handle each type of issue.
You can also use Retry Scope, which may be useful for handling loading errors and things like that.
You should also may good use of things like ‘Element Exists’ to verify each step has completed correctly before proceeding. Ensuring pages have fully loaded (Complete, rather than partial) is also a good way to reduce the risk of error occuring in the first place.
Basically, you need to look at each of the known scenarios, decide how you can handle it, then handle it.
Then have a catch-all try/catch that gets you back to a known state and tries everything again (may include killing and reinitialising apps, for example).
Best of luck!

hi @sowmiyan if i understand your issue properly, you can add, find element to wait for element to load then once loaded if element exist then click start the next activity.

find element (continue to error) > element exist > click or other activity

1 Like

Yah in that case we can use ON ELEMENT APPEAR once after clicking the submit button
Where with on element appear activity choose any element that appears always in the next page once after submit button is clicked
Or if it’s a not a element we can use ON IMAGE APPEAR activity
Inside that container we can place the remaining set of activities to be performed

Cheers @sowmiyan