Search Results

Using the Catch and CatchAll Block

You can place a Catch block in your process to deal with unhandled exceptions. Using the Catch block, you can create a track that handles the exception and proceeds to the end of the current scope; either the end of the process or the end of a group.

You can use the Catch block as an alternative to individually handling exceptions for each activity, or you can use error transitions to handle some exceptions and the Catch block to handle others.

The following figure illustrates the Catch block. 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 CheckInventory activity. A log file entry is written after which the transition is taken to the end of the group. If the inventory is available, the order is processed, a confirmation message is logged, 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 ForEveryLineItem group, execution transfers to the CatchAllOthers activity

Example of using the Catch block

The Catch block 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 General tab of the Catch block. Any exceptions that are not already handled by an error transition or Catch block can be handled by a Catch block that specifies the Catch All option on the General tab.

See the Bindings and Palettes Reference guide for more information about the Catch .