When a step of a job fails, the job is aborted. To perform some clean-up actions before the job finally exits (such as logging or sending email notifications), you can create steps of type "error/success handling step". The error/success handling steps allow you to protect the execution of one or more steps, referred to as a "protected block". The following diagram illustrates the structure of a protected block.
Structure of a protected block
When any of the steps within the protected block fail, error handlers control what happens before the job finally exits. Error handlers can be one of the following:
|•||On Success (instructs the system to perform some action if all steps in the protected block were successful)|
|•||On Error (instructs the system to perform some action if any of the steps in the protected block were not successful)|
|•||Always (instructs the system to perform some action regardless of whether the steps in the protected block were successful)|
When the protected block finishes executing, FlowForce Server executes any defined handlers based on the outcome. For example, on the diagram shown above, the protected steps are Step A and Step B, and the error handling logic is as follows:
|•||If A fails, then A, C and E will be executed.|
|•||If B fails, then A, B, C and E will be executed.|
|•||If A and B are successful, then A, B, D and E will be executed.|
In practice, it is not necessary (although it is possible) to define all three handler types for every job that you want to handle. The most common scenario is to define only On Error and Always handlers.
|•||Adding Error Handling to a Job (example)|
© 2019 Altova GmbH