Designer > Fault Handling > Defining Catch and CatchAll Fault Handlers

Defining Catch and CatchAll Fault Handlers

You can define two types of fault handlers:
You can define <catch> and <catchAll> handlers for the process on the Process Editor Fault Handlers tab, as described in Adding a Fault Handler.
The following illustration shows an example of fault handlers created on the Process Editor canvas.
You can also define fault handlers for a scope, as the error catch event, labeled Catch All, shows in the following illustration.
You can define each catch activity to intercept a specific kind of fault, defined by a globally unique fault name and a variable associated with the fault. Optionally, you can have a defined type associated with the fault variable, either a message type or an element type.
XML Syntax
<catch faultName="QName"?
(faultMessageType="QName" | faultElement="QName")?>*
Required Properties
Optional Properties
Catch only:
Fault name only or fault variable only or fault name plus fault variable
Catch only:
Fault name, Fault variable definition, Fault variable
Comment. See Adding Comments to a Process
Documentation. See Adding Documentation to a Process
See Setting Visual Properties and Using Your Own Library of Images.
Execution State. See Viewing the Execution State of an Activity or Link
Extension Attributes and Extension Elements. See Declaring Extension Elements and Attributes.
Catch Fault Name and Fault Variable
The fault name and fault variable/variable definition are optional attributes, but you must provide at least one of them for a <catch>. These attributes determine which catch in a fault handler executes when a fault is thrown.
If you do not define either a fault name or variable, the catch is executed as a <catchAll>.
In most cases, the values for these attributes are from the WSDL for a service being invoked. The name of the fault is typically the name of fault on an operation with the target namespace as the qualifying namespace value. The variable for a fault is typically the message sent when an operation in WSDL throws a fault. In the case where a catch includes a fault variable, that variable must be defined within the catch. This variable gets populated with the data from the fault when the catch executes. In addition, Process Developer provides special handling for undeclared faults.
For more details about the use of fault names and variables, see the following topics:
CatchAll Handler Examples
The <catchAll> catches any faults that were not caught by an existing catch block. The benefit of this construct is that you can be sure that your fault handler has an opportunity to execute your fault handling code in the event a fault is thrown. One drawback is that you will not have any details regarding the type of fault that was thrown since there is no fault name or fault variable available to a <catchAll>, per se. However, Process Developer provides custom functions to handle undeclared faults in a <catchAll>. This construct is best used in cases where you do not care what fault is thrown or in cases where you want to be sure that no faults get past your existing fault handler logic.
The default <catchAll> fault handler is as follows: