UIPath Global Exception Handler is not working with Try Catch

Hi everyone,

I’m working on creating a bot that downloads Excel files from our internal web tool. The process involves reading an Excel file, storing the data into a DataTable, and then looping through each row using a For Each loop. For each item, the bot selects a dropdown value, sets date filters, checks a few boxes, and finally clicks the “Run” button to download the file.

Previously, I had a Try-Catch block around the dropdown selection activity. If the item wasn’t available in the dropdown, the bot would catch the exception and continue with the next item in the loop. This was working perfectly.

However, after adding a Global Exception Handler to the flow, the behavior changed. Now, when an invalid dropdown item is encountered (intentionally added for testing), the bot skips the Catch block and instead triggers the Global Exception Handler. It retries three times and then exits the flow.

What I want is for the bot to follow the Try-Catch block logic and move to the next item in the loop, instead of invoking the Global Exception Handler.

Flow Details:

  • I’m using a Flowchart in Main.xaml.
  • It contains six sequences: ReadFiles, BusinessDayCalculation, LaunchBrowserApplication, DownloadReport1, DownloadReport2, and DownloadReport3.

Has anyone faced a similar issue or found a workaround to ensure the Try-Catch block is respected even with a Global Exception Handler in place?

By the way i created another sample flow with Global Exception handler and Try Catch and it works perfectly fine. Not sure what is the issue with my main Flow.

@amol.wakcaure

ideally GEH triggers when there is exception even if there is a try catch and then it goes to try catch if it fails after retry also

only one exception is if a single activity with no sequence is kept in a try catch in that scenario GEH will not come into picture

So try having single activity in try catch and it would ignore GEH

cheers

Hi @amol.wakchaure

Check the below thread

Hope it helps!!

Hi Anil_G,

Thanks for responding to my query.

I actually have only activity inside Try block that is Select item from drop down. In catch block I have System.Exception with Log Message, add log details data row to the DataTable, then write log to Excel file and a Assign activity Flag of error True/False. in Finally section I have If activity that checks Error flag(have initiated flag also at the start of the Try Catch Block). if there is an error i have added continue statement that skips rest of the steps and move to next item in For Each Loop.

Hi Parvathy,

Thanks for your help. I checked this but i guess this is different issue. Here user did not add GEH but Try Was failing and that because Project.jason was still showing GE in the project.jason. I removed the that specific file and tried. It follows Try Catch and go to next item in For Each.

If I remove GE Try Catch works perfectly fine but I need GE because there are other activities which are failing frequently hence I need to try them at least thrice and then throw exception.

Regards,
Amol

Hi @amol.wakchaure

Both Try Catch and Global Exception Handler will not be possible to be done in Studio X. You will either have to use Global Exception handler or Try Catch.

Regards
PS Parvathy

Hi,

I am using UiPath Studio.

snapshot-

image

Regards
Amol

Can I do something like this and suggest will it work and its implications.

If errorInfo.Exception.message.contains(“Selected item not found”)
Then

Regards,
Amol

@amol.wakchaure

Is the assign activity also inside try catch?

There should be literally only single activity and the default sequence you see in try also should be removed

Cheers

Thanks for your help. much appreciated.

I have created another flow only to read Data from Excel and Select Item in drop down in For Each Loop. There it follow Catch Block. So i just wonder what is wrong with my Main flow. All activities are in Flowchart with multiple sequences in main.xaml file. I guess some kind of issues with flow set up.

1 Like