Using the Catch and Rethrow Activities

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 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 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. Rethrow activity rethrows an exception but to catch it your second catch block, Rethrow activity should be in a group. 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.

Using the Rethrow activity, you can 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 activityand Rethrow activities, see the TIBCO BusinessWorks™ Container Edition Bindings and Palettes Reference guide .