Try Catch Finally

How can we implement Try - Catch - Finally Structure in Flow?

Hi,

I know how to do the Try-Catch but I’ve never used the Finally!

  • First create a SEQUENCE step and configure the “Exit on” property with value, “SUCCESS”.
  • Within this Sequence step, create two child SEQUENCE steps.
    The first child SEQUENCE step (Try block) must have the “Exit on” property value set to “FAILURE” and the second child SEQUENCE step (Catch block) “Exit on” property value must be set to “DONE”.

Hope this helps.

–Sequence (Exit on Success) Try/Catch
----Sequence (Exit on Failure) Try
----Sequence (Exit on Done) Catch
–Sequence (Exit on Done) Finally

In your catch block if you call ‘Exit’ flow step by setting ‘Exit with Failure’, the flow service will get terminated without going into the Last sequence.

HTH
Senthil

Thanks for the reply.

i was trying to figure out using the mentioned structure,
So if we are using the finally block as shown above, should i remove the ‘Exit with Failure’ setting or should i remove the Exit step itself?

-Regards,
ssagar

I believe you don’t have to use Finally block sequence and just use catch block with Exit with Failure step at the end and it will throw error (this will help rollback situations working as expected)

Correct me Senthil If I am wrong:

HTH,
RMG

Be careful that you understand the scope of pipeline variables. Although the terminology being used (try, catch, finally) is equivalent to Java be aware that the behavior is not the same as Java.

Another tip: don’t go overboard with using try/catch sequences. Use them only when they do something useful.

Thanks for your suggestions, Rob, RMG, Senthil and Kratos