Designer > Fault Handling > Fault Handling Processing Rules
  

Fault Handling Processing Rules

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 <catch> or <catchAll> is matched in order to execute. The rules for matching a fault are as follows.
Prior to the execution of the matched <catch> or <catchAll>, 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.
Example
<faultHandlers>
<!-- catch all faults with a matching name, but no data -->
<catch faultName="x:foo">
<empty/>
</catch>
<!-- catch all faults with the matching variable type,
whose name is not "x:foo"-->
<catch faultVariable="bar"
faultMessageType="tns:barType>
<empty/>
</catch>
<!-- catch the fault specified by the name
and variable type -->
<catch faultName="x:foo" faultVariable="bar"
faultMessageType="tns:barType>
<empty/>
</catch>
<!-- catch all faults not caught by a specific handler -->
<catchAll>
<empty/>
</catchAll>
</faultHandlers>
The Rethrow Activity and Fault Handling
A BPEL process can rethrow an original fault caught by the nearest enclosing fault handler with a <rethrow> activity. A <rethrow> 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 <rethrow> activity always throws the original fault data and preserves its type.
Links and Fault Handling
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.