How to use Throw and ReThrow

I´m not the most technical person and I might say something wrong, so please correct whoever knows, but from what I´ve seen…

Let´s say you´ve got a try/catch activity where the try throws an exception. If you put a Rethrow activity in the Catch block and run the robot from UiPath Studio, then you will get the pop-up window with the exception message and details, and the robot will stop.

On the other hand, if you run that same process from Orchestrator, I think that the robot will give you the error details, but it will continue running.

Please, correct me if I am wrong.


Hi @ander.labaka

Welcome back!

No, the idea of throwing an exception is to either stop the process or handle that particular exception. If you re-throw an exception, it will stop the process no matter if it was run from Studio during development or from Orchestrator.


I have implemented an example for the same and what i have observed is…

  1. If i put throw in my Try block it will just throw whatever customized exception I have included in my throw. This will just through a pop up displaying the exception message.
  2. If the same has been handled used Rethrow in Catch block, an exception is thrown instead of a message box and the process is stopped abruptly. This exception is like any other exception containing the information mentioned in Throw(Source, Message, Exception)

This is correct. If you have an exception and you catch it, it will not stop your process. However, When you rethrow in the Catch block, then it will need to be caught in a Try-Catch above or else it will throw an exception an stop the process.



new Exception(“Throwing an exception because something went wrong”)


Hello Guys!

I tried using the throw and rethrow but I’m always getting the throw message in the catch even if there’s no error in the code. Would you be able to help on how to use rethrow and throw properly? I’m using throw and rethrow because I want to customize the error message that I’m having. Thanks



What I did was

Try catch

throw (new exception (“msg”)
System.exception (exception.message"


@bdavidov - In simple terms Rethrow is used when you want activities to occur before the exception is thrown. Throw activity is used when you want to throw error before the execution of the step


Hello @sandipauti

How are you? Would you be able to help me to share your knowledge on how to use throw and rethrow or use customize exception? if you have a simple sample, please share. thanks


@Callos_James_AU - I am good thanks , To create your own custom exception like new Exception(“Some message”) just use throw exception activity and pass exception message like Throw(new Exception(“Some message”))


Hey guys,

Hope this might help you :slight_smile:

Sharath Raju

Can throw be used inside a catch ? The GetAppCredentials of old RE framework has throw inside catch but it is not getting trigerred. What is the solution for it?

Hi All,

Here is the workflow which will show the correct use of Throw activity within try catch
Practise Solutions for (97.2 KB)
Main.xaml (26.0 KB)

Before running the workflow just do the following 2steps :-

  1. Within try catch Inside type into activity Enter Wrong username & Password of website if you have
  2. Within Catch Inside type into activity Enter your correct username & Password of website if you have

Hope this workflow may help you to solve the query
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Main.xaml (12.4 KB)