B2B Integration 10.4 | Administering and Monitoring B2B Transactions | Service Development Help | Failure Handling in Flow Services Using the TRY, CATCH, and FINALLY Steps | Usage Patterns for Failure Handling | TRY-CATCH
 
TRY-CATCH
The TRY-CATCH usage pattern consists of a single TRY step followed by one or more CATCH steps. The TRY step contains any number of child steps to be executed. The CATCH step contains any number of child steps to be executed if the TRY step fails.
Integration Server executes a TRY-CATCH in the following way:
1. Integration Server executes the steps contained in the TRY step sequentially until all steps have been executed or one of the steps fails. When a failure occurs in one of the child steps, Integration Server does not execute the remainder of the child steps. Instead Integration Server exits the TRY step with an uncaught failure.
2. If there is an uncaught failure, Integration Server evaluates the first CATCH step that follows the TRY step to determine if the CATCH step handles the failure. The failures that a CATCH handles depend on the combined values of the Failures and Selection properties of the CATCH step.
*If the first CATCH step handles the failure, then Integration Server executes the CATCH step. Integration Server ignores any subsequent CATCH steps associated with the TRY step.
When a CATCH step completes normally, the failure is no longer uncaught. Integration Server discards any pending exception.
*If the first CATCH step does not handle the failure, Integration Server evaluates the next CATCH step if one exists.
Integration Server repeats step 2 for subsequent CATCH steps associated with the TRY step until a CATCH step handles the failure or no CATCH step remains. If no CATCH step handles the failure from the TRY step, then Integration Server propagates the uncaught failure from the TRY step to the parent flow step.
In the following example flow service, a TRY step executes the pub.file:getFile service. If the pub.file:getFile service throws a service exception, Integration Server exits the TRY step and executes the CATCH step.
Example of a TRY-CATCH

Copyright © 2016- 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release