I would like to get some comments on how everyone is handling Retriable vs Fatal errors please.
As an example - I have a state machine with a separate Error Handling State which would follow from any other failed state. Each state has it’s own TryCatch block to catch various exceptions and if one is caught a boolean value boolSuccess is set to False which takes the transition to the Error Handling state.
My objective is to determine whether to allow Retries after the error has come through the Error Handling state. E.g. if the exception was thrown at the Authentication state, I would want the process to stop, otherwise any other state I’d want to retry from the beginning of the loop.
I already differentiate between different types of errors, e.g. IO, BusinessException, which have own logic. However the generic ApplicationException type for all unexpected errors is posing a bit of a challenge. I add the word “Fatal” into the exception.Message and then have logic in the Error Handling state to allow/disallow Retries based on that, but I wanted to see other ways of dealing with this.
I’m not entirely sure what you’re trying to achieve with this code. Please ensure that you’re using Try-Catch blocks and Retry Scope effectively wherever possible. There might be a more efficient approach than using a state machine in this case, but I’d need more details to confirm.
Below are some common properties of an Exception Variable. You can use a combination of exception.Source and exception.GetType() in an If or Switch condition to accurately identify and handle application errors. Try to print some of these and see.
Property
Description
exceptionVar.Message
Returns a short description of the error.
exceptionVar.Source
Identifies the activity or component that caused the exception.
exceptionVar.GetType()
Returns the exception type (e.g., System.TimeoutException).
exceptionVar.StackTrace
Provides a detailed trace of where the error occurred.
exceptionVar.InnerException
Retrieves nested exceptions, if any.
exceptionVar.HelpLink
Contains a link to documentation (if available).
exceptionVar.HResult
Returns a unique error code.
exceptionVar.TargetSite
Retrieves the method where the exception was thrown.
hi, apologies, went over my question and I’ve not explained it enough:
The state machine contains states with Try Catch blocks, which can house activities and other invoked flows which already have TryCatch blocks, retry scope, and other methods, I’m happy that all the errors are caught and handled where necessary.
When an error is caught in a state/component within a state, I assign a boolean boolSuccess = False and the transition takes the process into the Error Handling state.
For ease of processing and standardisation, a separate Error handling state was created which has things like Failure email notifications, Set Status to failed, other logs.
I just wanted to see if there was a way to mark some exceptions as Fatal and others as retriable. Thank you!