Unable to catch runtime execution errors

Hi,
I have a try catch surrounding my process and it still is unable to catch runtime errors related to UI element not found in a Chrome automation.
The Try Catch exception is set to System Error Exception so that it catches everything but it doesn’t log the error or email me. Instead, it hangs with the popup


screen to Retry or Stop. Any ideas?

Hi,

It may be caused by GlobalExceptionHandler.
For now, can you check if GlobalHandler is set in your project at project panel and/or project.json file.?

Regards,

Hi Yoichi, I tried adding the try-catch conditions to the global handler. It does now catch some of the errors and send the admin in email but it still doesn’t catch the UI element node not found even though I’ve placed it as a condition in both the Global Handler and process Try Catches. I read that order matters so I’ve put the UI element one first and then the system error condition next.
Any other thoughts?
My goal here is to best case catch the error and have it do the equivalent of clicking “retry” when the error occurs and worst case emailing me if it encounters the error.


Hi,

In my opinion, it’s better not to use GlobalHandeler if you use try-catch.
Can you try to remove Handler as the following? Then use TryCatch where you want to catch exception.

Regards,

Do you have Continue On Error set to True in your TCO Browser activity or any of the activities inside it?

Hey Paul,
No, I haven’t set it to continue on error for any of my activities. Until Yoichi’s suggestion I hadn’t touched the Global Handler. It was empty and the “UI Element Not Found” errors still weren’t being caught. I’m cautiously optimistic but so far disabling the Global Handler has worked in catching these errors.

1 Like

I disabled the Global Handler and it seems to have done the trick! What’s weird to me is that I had not done anything to the Global Handler until you mentioned it but somehow it was still interfering.
Is there a way to program the try-catch to do the equivalent of clicking retry on the error screen? I feel like there should be but I haven’t found anything except retry scope which doesn’t seem to be what I’m looking for.

You can put the activities for clicking retry on the error screen, inside the Catch block.

However, Retry Scope may actually be what you want to use. It will repeat the activities inside it if there is an exception. You can set it to a max number of retries, and then put a Try Catch around it to catch if it reaches the max retries but still throws an exception.

I read somewhere in the forums that it’s best not to have nested try-catches. Right now the Try-Catch surrounds the whole process and lists the UI Element Not Found Error first and then the system error conditions. For the Retry-Scope, my understanding is that it would retry that specific activity or sequence of activities starting at the top. Is that correct?
I just added Retry Scope to the usual culprit for the UI Element Not Found error but it didn’t retry when I forced the error by closing the tab. Here’s a screenshot of the Retry Scope activity.
I haven’t set the Continue on Error property because I read that it would negate the entire Try-Catch which wouldn’t be ideal if the error continues after the Retry Scope.

You can nest Try Catches, it’s fine.

If you need to Retry if there’s an error, and have to clear an error prompt before retrying, what you want to do is

  • Retry Scope
    – Click (set continue on error true)
    – Check App State for error
    — if appears, Click to clear error then throw exception
1 Like