Hi,
Is retry scope an exception handling mechanism? How is retry scope used in exception handling?
Thanks
Hi,
Is retry scope an exception handling mechanism? How is retry scope used in exception handling?
Thanks
We cannot say that retry scope is exception handling mechanism but its dedicatedly use to make to improve your reliability of your code.
some frameworks or libraries might use the term “retry scope” to refer to a mechanism that allows you to retry a certain block of code in case of exceptions or errors.
how to use
Activities - Retry Scope (uipath.com)
Retry scope can be thought of as a type of exception handling mechanism. It will retry (up to the set limit) if there is an exception. Also, the newer version has a Condition you can add, making it function somewhat like Do While.
However, if the Retry Scope uses up its max number of retries and there is still an exception, then Retry Scope throws an exception - which would have to be handled with a Try/Catch around the Retry Scope (or the code block the Retry Scope is in).
Thank you, @postwick I am trying to understand retry scope in the context of exception handling. Would
appreciate if there is an example to look at.
Many Thanks
As a simple example, on rare occasions we get an exception when trying to use Set Transaction Status to update a Queue Item. So to handle this, I put the Set Transaction Status activity inside a Retry Scope, set to 3 retries with a 2 second interval. It will then try to execute the Set Transaction Status up to 3 times, waiting 2 seconds in between tries. If one of those three tries succeeds, the automation continues. If all three of those tries fail, Set Transaction Status throws an exception.
Note that you aren’t limited to just one activity inside Retry Scope. It can be a series of steps, multiple activities, and the retry will kick in if there is an exception at any point - including an exception you manually generate using the Throw activity.
And this still need to be handled with try catch?
Thank you
The Retry Scope will handle the Throw and start over (retry), until the retry limit is reached. Once the retry limit is reached, Retry Scope will generate an exception which, yes, you’d have to handle with Try/Catch (assuming you don’t want the Job to just fault).
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.