Difference between Throw and Re-throw

Can you tell the difference between Throw and Re-throw.

Throw activity is to be used to explicitely throw an exception that you define

When you use a Try-Catch, and there is an exception thrown, you enter the Catch Block.
Here you can perform certain activities like take screenshot and log the error. But, here the exception that is thrown will get consumed. If you need that the exception gets propagated you should use Re-Throw.


Hi @akshi_s27, i don’t get that re-throw properly.

1 Like

Hi @Krish

Rethrow - throws a previously thrown exception from within a TryCatch activity(as @akhi_s27 explained). The error is rethrown retaining the original source of the exception. Rethrow can only be used within a Catch block of a TryCatch activity.


OK … but how do I get the actual exception info in the catch block - so I can log the error without stopping the robot?

and how do I create a custom exception using Throw??