Try Catch Process

Hi There,

as per the screenshots below i am trying to create a process whereby a try catch is used to help identify one of two possible outcomes. The first being that i have to delete several thousand rows from an access database by clicking 3 buttons from notification windows, “yes” “yes” and “ok” (these show up in black for some reason). The other (catch) is where all rows are already deleted and a single notification pops up, and i click only “ok”. I have used an element exist panel since these actions can be dynamic in their respected time. Any idea why this process would fail or if the logic needs to be reworked?

Scenario 1 - try

Scenario 2 - Catch

Thanks in advance

Hi @bostonwheeler,

Can you please let us know what exception you are getting or where is it failing exactly?

Is it the Click Activity that is failing or the On Element Appear activity?

Many thanks,
Hiren

the exception i am throwing is an activity time out - i tried adding this exception to the try block, and it appears to throw the same error as well.

Hello

Would an if activity be better than a try/catch if you’re trying to identify one of two possible outcomes?

1 Like

I agree with Short. In general, you should be using try-catch blocks for error handling. What you want to do is control the workflow where something is blank or it isn’t, so you should use an If activity instead.

This greatly improves readability of your workflow and will also go faster as you don’t have to wait for an activity timeout “error” to happen

Hello @bostonwheeler, just like the others say, it seems like you want to branch your flow depending on element appeared. If so, I think it is better to use other activity since I don’t think Try Catch deserves the purpose here. Have you checked Pick Activity?