I have an important subject that I to want bring to your attention.
The case is the following:
We have a sequence (a Main) in which we put a Try Catch.
In the Main-Try we call a subsequence (a Sub).
In the Sub we put another Try Catch.
In the Sub – Try we Throw an exception (a regular exception, doesn’t matter)
In the Sub – Catch we Log the Exception and add a Rethrow .
In the Sun - Finally we put a Log Message!!!
In the Main – Catch we do something… (show the Exception message or something)
In the Main – Finally we do something…
My Questions is this: Why the program doesn’t run de Sub-Finally statement in this case ???
( I have tried to do the same thing in a Main, with a TryCatch and inside it added another Try-Catch and it shows both Finally activities , like it’s supposed to.)
I have attached an example script for better understanding.
Thank you for your reply/help.
TryCatchEx.zip (5.5 KB)
I tested and its working for both finally:
Thank you for your answer!
This is what i get:
It’s really suspicios…
I am using the Studio :
Studio Version v2017.1.6522
I have also tested it on : Studio 2018.3.2 Community Edition too…same error. (doesnt show Finally in sub)
What Studio are you using?
Firstly what i was doing was debugging your code then chose an option to continue when i was asked for the rethrow action.
So my mistake there.
Bu the issue actually is that you are trying to throw a exception inside the sub workflow an expect it to propagate it to the main one.
I dont think that will happen.
If there is an unhandled exception inside a catch handler block, the finally block gets called exactly zero times and that is what is happening in this case.
I have noticed, is that if an exception is thrown in TRY block, that is caught in Catch Block and Re-thrown from Catch block then the code in Finally is not executed.
I believe that to be by design, If you re-throw the exception it will interrupt the current activity and go out of it.