Fault Handling Processing Rules
When a fault occurs in a process, the flow of execution moves from the activity that generated the fault (for example, the invoke that faulted during execution or a throw activity) to the immediately enclosing scope's fault handler. If there is no immediately enclosing scope, the execution moves to the process's fault handler.
Once at the fault handler, a single
is matched in order to execute. The rules for matching a fault are as follows.
There are several rules and a catch-matching priority scheme for executing a
For details, see
Rules for Catching Faults in a Catch Activity
If fault cannot be matched to a
using the rules referenced above, then it executes the
If there is no
within the fault handlers, then the implicit fault handling logic executes. This logic acts like there is a
present that contains a single compensate activity that executes the default compensation routine for all enclosed scopes. Once executed, the original fault is rethrown to the next enclosing scope or the process if none is available. If the handler is already at the process level, then the process terminates with the fault.
Prior to the execution of the matched
, all of the activities within the scope are terminated. Once a scope catches a fault, it is considered to have not completed normally and as such is not eligible for compensation for that execution. If the scope catches the fault without rethrowing the fault, then normal process execution can resume from the point of the scope on. If this happens at the process level, then the process completes normally but would not be eligible for process instance compensation.
In the following example, notice that the fault name and fault variable are not unique across catch activities.
<!-- catch all faults with a matching name, but no data -->
<!-- catch all faults with the matching variable type,
whose name is not "x:foo"-->
<!-- catch the fault specified by the name
and variable type -->
<catch faultName="x:foo" faultVariable="bar"
<!-- catch all faults not caught by a specific handler -->
The Rethrow Activity and Fault Handling
A BPEL process can rethrow an original fault caught by the nearest enclosing fault handler with a
activity can be used within any fault handler. Regardless of how a fault is caught and whether a fault handler modifies the fault data, a
activity always throws the original fault data and preserves its type.
A link that crosses a fault handler boundary must be outbound; that is, it must have its source activity within the fault handler and its target within a scope that encloses the scope associated with the fault handler.