Use try-catch and throw

Hi,

So I want to do error handling for an excel error. I’m using a try-catch activity. Inside the try, I put a parallel with the main excel process, and then in a second branch I put an UI Element exists for the error with 1 minute of time (which is the max time for the main process).
After the Ui Element exists, if it’s true there’s a throw activity with “new Exception(“Error”)”.

Then in the catch there’s sequence to close the error.
The problem that I have is that once the error appears it goes to throw, but it gets stuck there, and it’s not going to catch.

How am I supposed to link the throw with the catch?


Thanks

in the catch you need to have the same exception type as you have in the throw (Exception in your case).

I just added some screenshots so you can see it. Thanks

we cant see where the throw activity is, but if it is inside the TRY part and no container activity is marked as ContinueOnError = TRUE, then it should work.

Everything is as you said. Plus, when I run in debbug mode, it works fine. But when I run normally, it gets stuck in the throw activity and nothing happens…

do you see that error found message in your log?

No I don’t

so it means you are not getting to the throw activity…

In this screenshots you can see that I get the log message before the throw. And that’s the last thing I have in my log, it stays stuck in that for minutes…

Capture2

first i ask if you see this and you say you didnt…

Oh I thought you meant an error message from the throw activity, sorry

can you put another log right after the throw activity?

Yes I just did, it’s stopping before the throw, doesn’t reach the log after the throw

good, that was expected, now put another one BEFORE the element exists inside the CATCH… maybe your element exists is with wait forever option…

It doesn’t reach that log, so the last one I see is before the throw. The thing is that the throw works in Debug and not in Run…

humm, i still think something is not right… just in case, can you fill back the variable name for that Catch exception property?

Yes I just did, and it’s still getting stuck…

gee i dont use much parallel activity, so maybe there is something we are missing with it… we should call for some reinforcements on this :sweat_smile: @Palaniyappan @Lahiru.Fernando

2 Likes

@jadbenn Can you show us the Whole parallel Sequence?