Typical Flow of an Exception Thrown in a Task

Handling Errors 19-9

d. Click OK.

The Type dialog box closes and the selected exception appears in the Exception field.

19.6 Throwing Exceptions in Subprocesses or Reusable Processes

You can only throw business exceptions using an error end event, thus only parent processes can catch these exceptions. You can configure your process to throw custom high level exceptions instead of throwing the low-level exceptions that occur while running the task. To throw a high level exception, connect the boundary events in your activities to the end event that throws the error, or finish the subprocess event with an error end event.

19.6.1 How to Throw an Exception

You can use an error end event to configure your BPMN process to throw a business exception. To throw an exception: 1. If you want to throw a custom exception, create a business exception. You can also throw existing business exceptions or system exceptions. See Section 19.6.3, How to Create a Business Exception for more information on how to create a business exception. 2. Identify the point in your process where you want to throw the exception. 3. Branch the flow of the process using one of these options: ■ Add a gateway to create a branch in the flow of the process. ■ Add a boundary event.

4. From the Component Palette, drag Error End Event and drop it in the process.

5. Add a sequence flow to link the gateway or boundary event, and the error end event. 6. Right-click the error end event.

7. Select Properties.

8. Click the Implementation tab.

9. Click the Browse button next to the Exception field.

The Type dialog box appears.

10. If you want to throw a system exception, Select Show System Faults.

The tree shows the available system faults. For a list of the supported exception for the different error events, see Table 19–1 . 11. Enter the name of the exception or select it from the tree

12. Click OK.

The Type dialog box closes and the selected exception appears in the Exception field.

13. Click OK.

19-10 Modeling and Implementation Guide for Oracle Business Process Management

19.6.2 What Happens When You Throw an Exception

The BPMN Service Engine interrupts the process and throws the exception to the parent process. If the subprocess has an error catch boundary event attached or the parent process has an event subprocess that can handle the error event, then the parent process can handle the exception. Otherwise the parent process throws the exception to its parent process. If it does not have a parent process, then the BPMN Service Engine logs the exception to the Oracle Enterprise Manager fault handling system.

19.6.3 How to Create a Business Exception

You can create a business exception and use it to implement the error events in your BPMN process. To create a business exception: 1. Right-click a module in the Business Catalog. If the business catalog does not contain a module, then you must create one.

2. Select New.

3. Select Exception.

4. Enter a name to identify the exception.

5. Click OK.

The Business Exception Editor opens. 6. Optionally, you can change the errorInfo attribute. See Section 19.6.5, How to Configure the ErrorInfo Attribute in a Business Exception for information on how to modify the ErrorInfo attribute.

19.6.4 What Happens When You Create a Business Exception

The exception appears in the business catalog in the module you selected. You can configure an error end event in your process to throw this exception, or you can configure a boundary error catch event to handle this exception.

19.6.5 How to Configure the ErrorInfo Attribute in a Business Exception

Business exceptions contain an errorInfo attribute that you can use to store relevant information about the situation that caused the exception. You can use the information in this field to help users, process developers, and administrators understand the cause of the error. To configure the ErrorInfo attribute in a business exception: 1. Open the Business Exception Editor. 2. In the Attributes section, expand the errorInfo attribute. 3. Make changes to the errorInfo attribute properties. You can modify the following properties: ■ Description ■ Documentation ■ Type

4. Click Save or close the Business Exception Editor, and save the changes.