Difference between Throw and Re-throw

activities
exception

#1

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


Abort workflow
#2

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.


#3

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


#4

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.


#5

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??