Try-catch issuew

I have a workflow, that simplified looks as follows:
Step 1 - Gather information
Step 2 - Process information
Step 2.1 - Proccess step A information
Step 2.2 - Proccess step B information
Step 2.3 - Proccess step C information
Step 3 - Send and close

I have added a Try-catch for all of step 2, so if something failes, status will change and exceptions will be caught, so far so good. I have also added a try catch in step 2.2, my problem is, when this is caught, the flow continues to step 2.3 - how do I make it go directly to step 3, if an expection occurs in step 2.2?
I would like to have something like “change state to…” when an exeption is caught in step 2.2 but cannot find it. I see there is a “set transaction status” is that what I am supposed to use, or is there another way?
I suppose I could create steps 2.1 - 2.3 as separate flows and invoke them in step 2 - is that the best way?

Hi NielsOlsen,

Add a “Rethrow” activity in the “catch” block. It should resolve your issue or else try “Throw” activity in any conditions like “IF”.


Hi @NielsOlsen

In Step2.2 catch block use Set Transaction Status activity and set the exception in orchestrator as per your requirement. Later use Rethrow activity which will throw same exception again and it will go to outer most Try Catch. In outer catch invoke Step 3 Workflow to send and close.

If we want to skip the next 2. Version and go directly to step 3 then instead of keeping each step of 2 in a try catch, keep the whole step2 and it’s sub steps like 2,1, 2.2, 2.3 all inside the TRY block of TRY CATCH activity so that if any exception occurs at any step it will skip the consecutive step 2. Version and goes to step 3 directly

And for this
We can use Set transaction status as we want in the catch block of TRY CATCH activity where we have included all the step 2 and it’s sub steps

Cheers @NielsOlsen

Ok, so if in step 2.2 I have an IF statement like “2+2 = 4” and this is not true, I add a ‘Set Tranaction status’ in the “Else” section? And what do I add in the ‘Set Transaction status’ to make it go to Step 3?
I have a transition called 'WebAdressError with condition 'strExecutionStatus = “WebAdressError” ’ this will make the flow go to step 3 - can I use that?

so it wil go to ELSE part where we can use THROW activity with input as New BusinessRuleException(“error”) so that it will go to CATCH block
where in the Catch block use SET TRANSACTION STATUS activity and as we have placed all the steps of 2 in the try catch block it will get skipped and goes to step 3 which isnot linked with set transaction status at all buddy

I get the following error:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.BusinessRuleException: WebadressError

If I click continue, it moves on to step 2.3 and not step 3 - any ideas?

I found the error - was an “a” and should have been an “A”… go figure :slight_smile: Thanks it works with the Throw and Transaction status.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.