Is there a way to stop the bot, if same system exception is happening for 3 times in a row?

Dear All,

I need to develop a bot to log in to a Government portal. Unfortunately, the portal will be down most of the time.

Is there a way i can stop the bot run if the same system exception is thrown for 3 times in a row EG:UI selector for Login page not found error thrown for 3 times in a row.

Bot should be able to continue processing even if error messages are different even if they occured 3 times in a row.

Appreciate all your suggestions and guidance. Thank you in advance.

Increase a counter in the SetTransaction sequence in the REF and compare to 3 in the GetTransaction sequence.

Thank you for your quick response. Just had a doubt- In this case how can we store the previous transaction exception message so that we can compare and increment the counter?.

Create a variable and assign Exception.Message as a value, do it inside the catch stage from a Try-Catch activity.
Maybe you could use the Global Exception Handler as well.

Thank you Lucas for your help. I tried this and is working.