How to get exact error message from retry scope

Hi,

If we use retry scope and fail to met the condition after max retry, then common exception message will be as below:
“Action failed to execute as expected”

However, we cannot find at which activity error occurred and what was the error message. So how can we retrieve the exact error/ exception message from retry scope after max retry?

Say there is a selector issue in particular activity, I need to get that exact exception message.

may be below syntax will help to get the origin source
Exception.source

Hi @vigneshnkv

You can use while or do while loops instead of retry scope.

Please try below steps.

  1. Use try catch inside the body of the loop and inside try you can have your process.

  2. If any error occurred it will goto catch and you can increment the count.(create a int variable and assign 1 at the start)

  3. In catch log the exception message which can be used later if want.

  4. In condition give how many time we want to retry the process.

Thanks

1 Like

Hi

Hope these steps would help you resolve this

Retry scope usually tries to retry the set of activities kept in action block until the condition mentioned is met
If the condition is not defined with any activity then retry scope will try to retry the activities mentioned in action block to the number of time we have mentioned in properties

In your case as you have the condition and number of retries to be made we can use DO WHILE as it will first execute and check for condition later like RETRY SCOPE

Don’t use While loop as it will first evaluate the condition and then only perform the operation

So the steps will be

—use a DO WHILE activity where place the set of activities to be performed in the Do block
And at the last inside the do block use a element exists or image exists activity and get the output as Boolean variable
We are doing this to replace the activity we place in CONDITION block of retry scope

—now in do while condition mention the above created variable

—so in DO WHILE the bot will execute the sequence of activities and finally check the condition with ELEMENT EXISTS or IMAGE EXISTS and get the Boolean variable

—that Boolean variable is now validated with DO WHILE condition block same as retry scope

—surround this DO WHILE with a TRY CATCH activity where place the above sequence in try block and in catch block use a common exception like SYSTEM.EXCEPTION

—inside the catch block use a WRITELINE activity where mention as
exception.Source.ToString
Will give the activity at which the error occurred

Hope this would help you

Cheers @vigneshnkv

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