Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Failure Handling in Flow Services Using the TRY, CATCH, and FINALLY Steps | About the TRY, CATCH, and FINALLY Steps | The CATCH Step
 
The CATCH Step
The CATCH step contains the sequence of steps that you want executed in the event the preceding TRY step fails. Often, the CATCH step contains recovery logic.
The CATCH step can be configured to handle all failures, specific failures, or all failures except specific failures.
The failure processed by a CATCH block is either an exception resulting from a failed service execution or a pending exception resulting from an EXIT step configured to exit on failure.
When executing a CATCH step, Integration Server executes the child steps in order, one after the other until the entire group completes successfully, a step fails, or an EXIT step executes. When a child step fails, Integration Server does not execute the remainder of the CATCH child steps. Instead, Integration Server exits the CATCH step and then executes the FINALLY step if one exists.
When a failure is caught by a CATCH step, the name and the associated Exception instance can be obtained by executing the built-in service pub.flow:getLastFailureCaught within the CATCH step. This service can be useful when a CATCH step is configured to handle multiple failures.