How to throw BRE properly (error code 1002)

Hello everybody.

I’m a beginner in UiPath and I’m doing a case just to learn REFramework better. It’s a very simple case of checking on a website if the input is valid (not complex for REF) but I just wanted to learn how to handle exceptions. When this input is invalid I wanted to make the transaction a Business Exception. The process flow is basically like this:
Type into (input) > Get attribute from the answer(“valid” or “false”) > Trhow BRE if false.
I’ve tried try catch many times but gives me the error of no queue item exists(1022). Also tried with Set transaction status but i know it has been deprecated. How would I try catch and trhow BRE in this case?

Thanks in advance!

Use the Throw activity and in it put:

New BusinessRuleException(“your desired error message”)

1 Like

I’ve tried several times. :frowning:
How can I add throw catch into this flow.
ConfereCPF.xaml (20.8 KB)

You don’t want to use a Try/Catch as this prevents the thrown exception from being addressed by REF.

If I add “throw” after the “invalid” option it says queue item does not exists.

The throw isn’t the issue. It’s the Set Transaction Status activity that is erroring. The Throw causes REF to jump to code that handles the exception. Run this in Debug mode so you can see where it jumps to and which activity errors.

Are you pulling items from a queue to run this?

In debug mode.

Yes I’m pulling from a queue.
First I add items from excel file to the queue and then I run the process…
Maybe something wrong with the process structure or as you said in the set transaction activity. Perhaps I need to change something in the .xaml of the transaction set?

It’s supposed to stop at the Throw in Debug mode. Debug stops when there’s an error, and Throw is an error. Click the Continue button at the top of Studio.

First ‘continue’

Errors bubble up through container activities. Keep clicking Continue until you get to the error thrown by the Set Transaction Status activity.

After come continues…
Changed the screenshot for the first hit on set transaction error…

Now you know where the Set Transaction Status is. You can click stop and investigate why it’s saying the queue item doesn’t exist.

I see somehow trying to invoke the workflow “test” which is the BRE i named just to test it.
Somwhow I need to modify the set transaction to understand that the trhow is to set transaction.
How can I correct this ?

I’ve got what was wrong :smiley:

Simply in the set transaction argument has the in_OrchestratorQueueFolder argument that references the config file. I simply put the name of the folder in the config file in the part of OrchestratorQueueName
and this time was ok! Beginner’s mistake hahaha!

Thank you Paul for the nice help!!

Cheers!

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