How to use the "EXIT" flow?

Hello Everyone.

I have a little doubt that even after a deep research I still not able to use the “EXIT” flow step.

I have the following situation flow situation:

Try:
Another flow service that returns IFRESULT = “E” or IFRESULT = “Z” with an “IFMESSAGE” variable
Branch on “/IFRESULT”:
E:
EXIT from $parent and signal FAILURE
Z:
<== Do something else ==>
Catch:
pub.flow.getLastErrorFromPipeline
<== Exception Handling steps here ==>

These are the values in “Properties” tab:

Signal: FAILURE
Failure name:
Failure instance:
Exit from: $parent
Failure message: %IFMESSAGE%

But when it reaches “EXIT” it goes to “Catch” and then “pub.flow.getLastErrorFromPipeline” but no message is recovered.

What should I do be able to recover the “%IFMESSAGE%” when throwing the Exception from the “EXIT” flow step?

Thank you

IIRC if you do an EXIT (with a message) from a sequence and then jump into another sequence within the same flow and do “getLastError” there, you won’t get the error mesage as part of the error object. This is a known behaviour (admittedly not very intuitive).

You have to write the service in such a way (pay attention to sequence “scopes”!) that the message text is still available in the catch block.

1 Like

I managed to develop what I wanted by creating a second service and invoking it. Inside of this new created service, I put the following steps:

Another flow service that returns IFRESULT = “E” or IFRESULT = “Z” with an “IFMESSAGE” variable
Branch on "/IFRESULT
E:
==> EXIT from $flow and signal FAILURE
Z:
<== Do something else ==>

After doing this I’m now able to get the “IFMESSAGE” value via the “getLastError” in the first service.

Thanks to your answer fml2