When you configure a BPD that uses external systems, you have to handle possible exceptions that might be generated in order to prevent errors or crashes.
For example, if a BPD includes an integration with a database system, that database may not be available when each new instance of the BPD runs. When you develop the integration in IBM® BPM, you need to build in exception handling to detect errors and recover in a predictable manner.
You can build error event handling capabilities into both BPDs and services.
There are two main constructs for building error handling into your BPDs: error events and error event subprocesses.
For BPDs, you can attach an intermediate error event to an activity and connect that event to an error handling flow or activity. You can also use an error end event to throw an exception to the parent process for handling.
| BPD event | Description |
|---|---|
Intermediate error event ![]() |
Use to catch process execution exceptions and handle exceptions with an error handler activity or further process flow. |
End error event |
Use to throw an exception to parent processes. |
When including error events in your BPDs, keep the following points in mind:
An event subprocess is a specialized type of subprocess that is not part of the normal sequence flow of its parent process. An error event subprocess is an event subprocess that contains an error start event. The event subprocess is not connected by sequence flow, and only runs if the start event in the event subprocess is triggered. You can use error event subprocesses to handle exceptions in your BPD.
For example, to ensure that any exceptions that might occur during process execution are captured, you can create a high-level BPD that includes an activity (to call the main process as a linked process) and then one additional activity (with an underlying service) to implement error handling as shown in the following image:

This type of design ensures that any exceptions thrown from underlying processes and services are propagated up and handled appropriately.
For services, you can include the following exception components:
| Service component | Description |
|---|---|
Catch Exception |
Listens for exceptions from the service component to which it is attached. |
Throw Exception |
Use to purposely throw an error and end processing. You might, for example, use a Throw Exception component if you return too many rows from a database (over a limit that is normal and would bog down the server). |
When including exception components in your services, keep the following points in mind:
When building services that include integrations with external systems or other complex implementations, you should use the Catch Exception component to ensure that errors are captured and users (such as administrators) are informed and, when possible, given an opportunity to correct the problems. Be sure to include the appropriate logic and a Throw Exception component in your services to throw exceptions in cases where they still exist after attempts to handle them. Throwing the exceptions ensures that the errors are passed up to parent processes and services and are eventually handled by a high-level process.
For example, the following image shows a service that catches an exception for a database query, attempts to handle the exception with a special script, and then (if the handler script fails) throws the exception for further processing by higher level services or processes.
