Hi there! I am currently working on a project that has a higher than normal rate of errors on the side of the application due to stability issues.
Can someone help me think out how to end a process after an X number of the same error are thrown?
For example, let’s say there is a component on the target site that sometimes fails to load in due to issues on their end. If this throws an error saying “Could Not Retrieve Data”, is there a way to make the unattended process stop after 5 of these are thrown?
In one of my project same circumstances was there I used Retry activity to handle it.
Depending on the process you could have a global variable(or an asset in Orchestrator) that you increase with 1 if that error occurs, and decrease if it doesn’t(if it is more than 0). And in the beginning of each transaction you would check the value of that variable to determine if you should stop the process.
So have a “TryCatch” around the sequence where that error occur and increment the variable in the “catch”.
If you are using the REFramework, I suggest you throw the error as system exception. Every REFramework has a try catch at the process transaction state.
In the catch flow, you have both business and application exception error handling.
You can set a counter here for consecutive application error which keeps incrementing when there is an application exception, but returns to zero if a business exception occurs between items. This counter will be a global variable.
In the main.Xaml you can then use the state machine condition to not retry an item after a given number failures say 5 application failures. Instead send it gracefully to the end state of the state machine.
Hope this gives you some food for thought
We use a similar logic to avoid robot setting application error for all the queue items. This is one of the most important features which is absent in the REFramework. It’s upto us as developers to ensure that an application failure does not result in 3 retires for every item in the queue.
in addition to what other have mentioned in the post, there is Global Exception Handler workflow.
Using this we can control number of retries and when to throw an error to stop the bot.
Hope this is useful