Hello everyone,
I am sorry if this issue has already been discussed, explained or solved in the past. I could not find anything since all results that appear are in regards to the REFramework that contains this logic.
This does not apply to my issue, as I’m handling a sequence that is not a transaction.
The result that I want to achieve is the following:
A sequence of activities is executed. When in that sequence an exception occurs, I want to handle it to retry the logic if a System Exception occurred, and not retry the logic if a Business Exception occurred.
The two possible solutions I was thinking about are the following:
- I can place the sequence of activities in a try / catch. I can catch two different types of exceptions: BusinessRuleException and Exception. In the handling of the type ‘Exception’ I can add a rethrow activity. I will place the entire try / catch scope in a retry activity.
- I can place the entire sequence in a try / catch that only catches BusinessRuleExceptions. Then, I can place that try / catch scope in a retry scope. If a System Exception was thrown, it will not be caught by the try/catch, as it only catches BREs. Then I can place the retry scope in another try catch, that will catch exceptions of type ‘Exception’.
What solution is better? Solution 1 seems like a cleaner / better solution to me, but I have never used rethrow before, and all the examples I see of it being used are of a “lower lever workflow” and a “higher level workflow”. As you can see, I don’t have that.
On the other hand, solution 2 makes sense and I know it will work, but doesn’t seem like “best practices” to me.
If neither solution applies to best practices, please let me know of other better solutions I haven’t thought of.
Also, before anyone suggests it, I am actually using a REFramerwork. However, there is a small subsection of the process that requires to be handled separately (as described above) due to some requirements.
Thank you in advance for your answers!