Using the Catch and Rethrow Activities
You can place a Catch activity in your process definition to deal with unhandled exceptions. The Catch activity allows you to create a track that handles the exception and proceeds to the end of the current scope; either the end of the process definition or the end of a group. You can use the Catch activity as an alternative to individually handling exceptions for each activity, or you can use error transitions to handle some exceptions and the Catch activity to handle others.
The following figure illustrates the Catch activity. The process waits for incoming orders sent by way of HTTP requests. When an order arrives, each line item is checked for availability in the ForEveryLineItem group. If an error occurs while checking the inventory, execution transfers to the CatchInventory activity. A log file entry is written, and then the transition is taken to the end of the group. If the inventory is available, the order is processed, a confirmation email is sent, and the response is sent back to the HTTP client. If the inventory is not available, a response is sent back to the HTTP client stating that one or more items are not available. If an error occurs outside of the ForEachLineItem group, execution transfers to the CatchAllOthers activity.
Example of using the Catch activity
The Catch activity can specify the type of exception that should be caught. A list of exceptions that can be raised in the current scope are available on the Configuration tab of the Catch activity. Rethrow activity rethrows an exception but to catch it your second catch activity, Rethrow activity should be in a group. Any exceptions that are not already handled by an error transition or Catch activity can be handled by a Catch activity that specifies the Catch All option on the Configuration tab.
Transitions cannot be drawn to a Catch activity. Also, you cannot draw transitions from any activity on the path of the Catch activity to any activity on the regular execution path. Activities on a Catch path can, however, have transitions to other activities on other Catch paths.
The Rethrow activity allows you to throw the exception currently being handled by a Catch path. This is useful if you wish to perform some error processing, but then propagate the error up to the next level.
For more information about the Catch and Rethrow activities, see
.