Using a fault handler

A fault handler associates specific fault activities on either an invoke or a scope activity that will execute when a fault is thrown by the invoke activity or an activity inside the scope activity.

In this case, the operation within the parent activity has NOT been committed, and it is possible to easily reverse the transaction. You can place activities on paths within the handler to either deal with anticipated faults, or attempt to find another way to complete the operation. Each path within the fault handler is preceded by either a catch, or a catch all element.

To create a fault handler on an activity, proceed as follows:

  1. Click the scope or invoke activity for which you want to handle a fault. The action bar will appear.
  2. In the action bar, click the fault handler icon as shown in this image. The fault handler in the action bar A fault handler is created with one default catch element, and shown in the canvas in association with the parent activity. You can place as many paths in this handler as necessary, and each one will be preceded by either of the following elements:
    Option Description
    Catch element The Catch element ity icon Use this element to intercept and deal with a specific kind of fault. You can use as many of these elements as is appropriate.
    Catch all elementThe Catch all element icon Use this element to intercept and deal with any fault that is not already defined in an existing catch element. You can only use one of these per fault handler.
  3. Populate the existing catch path with the activities that are appropriate to deal with the specific exception that has occurred.
  4. To add another path, click the fault handler to launch the action bar, and choose the appropriate element.
If a fault matches more than one fault handler, then the following rules determine which catch element will process the fault:
  • If the fault has no associated fault data, a catch activity with the matching fault name will be selected. Otherwise, the default catch all element is chosen.
  • If the fault does have fault data associated with it, then a catch element with matching fault name and variable values will be selected. If there is no fault name specified, then a fault with a matching fault type will be selected. Otherwise, the default catch all element is chosen.
If no catch or catch all element is selected, then the fault is rethrown to the enclosing scope. If the fault occurs in (or is rethrown to) the global scope, and there is no matching fault handler, the process terminates.
Related concepts
Best Practice: Choosing the appropriate compensation for your process
Related tasks
Compensating activities in a long-running process
Compensating a microflow
Typing fault variables

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.