About exception handling

Good evening,
I’m a user of UiPath Studio 2025.0.176STS Community edition.

I have two questions about exception handling.

[Prerequisites]

I’m currently creating a workflow that reads an Excel file, obtains a data table dt, extracts a DataRow variable dr_TransactionItem using the code below, and processes the DataRow variables one at a time.

dr_TransactionItem=dt.Rows(int_TransactionNumber)

The entire Main.xaml is enclosed in a TryCatch activity. If an exception occurs in the Try block, it is caught in the Catch block, where a log is recorded, and the workflow is terminated using the “Terminate Workflow” activity.

[Question 1]

I check whether the INPUT file exists at the beginning of the workflow (see the figure below).
The “Check whether the INPUT file exists” sequence is enclosed in a TryCatch activity.
If an exception occurs in the “Check whether the INPUT file exists” sequence, should I handle the exception in the Catch block of the TryCatch that encloses the “Check whether the INPUT file exists” sequence? Or should I rethrow it in this Catch block and handle the exception in the higher-level Catch block?

[Question 2]

I process one DataRow at a time in the “Process one business item” sequence (see the figure below).
The “Process one business item” sequence is enclosed in a TryCatch activity.
If an exception occurs in the “Process one business item” sequence, I want the workflow to continue running and proceed to process the next DataRow. So, my understanding is that I should handle the exception in the Catch block of the TryCatch that encloses the “Process one business item” sequence, without rethrowing it. Is that correct?

namaste @gorby Q1 If the error means the whole workflow cannot continue or either handle it locally with termination or rethrow so the top-level Catch ends the workflow consistently.

For Q2 surround the One Business Process sequence with a TryCatch and in the Catch block, log the error and move on to the next DataRow and do not rethrow here otherwise the exception will bubble up to the top-level TryCatch and stop everything.

Cheers

Hello @gorby

  1. INPUT File Check:- If the input file is missing, the process cannot continue, so catch the error, ‘log it’, then rethrow to the global Catch block to terminate the workflow cleanly.

  2. One Business Process (Single DataRow):- Handle locally, do NOT Rethrow. If processing ‘one row’ fails, ‘log the error’ and continue with the next row so the workflow keeps running without stopping.

Hey, exemplary Ashoka mind@bhavesh.choubey,
Your feedback affirmed my thinking and gave me reassurance.

While cleaning up my newly purchased e-VITARA.