Typical Flow of an Exception in a Subprocess

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.

Handling Errors 19-11

19.7 Handling Exceptions in Subprocesses

You can handle exceptions that occur in a subprocess in the same way you handle the exceptions in any other BPMN activity.

19.8 Handling Errors in a Peer Process Using Message Events

When a process communicates with another peer process, running any of the flow objects in the peer process may result in an error. For synchronic operations, the correct form of propagating these errors to the invoking peer process is using message events configured as errors. A message event configured as an error communicates to the invoking peer process that an error occurred while running the process. However the audit trail indicates that the process ran successfully because this is an expected error. You must define how the invoking peer process handles the exception using one of these options: ■ Add a boundary error catch event to the flow object that invokes the peer process. ■ Add an event subprocess that handles the exception to the invoking peer process. If you do not handle the error in the invoking peer process, the error propagates and the process running does not complete successfully. Difference Between Using Error Events and Error Message Events Using error end or throw events to handle errors during interprocess communication is not a good practice. You must only use error events for internal errors that might be handled within the process or propagated to the next level. These errors are not meaningful outside of this process. The exceptions occurred while running a peer process do not propagate to the invoking peer process. Eventually the invoking peer process receives a time out notification because the peer process stopped responding.

19.8.1 How to Handle Errors in a Peer Process Using Message Events

If you know running an operation in a process that is used for inter-process communication may result in an error, it is advisable to add a message end or throw event to propagate the error to the invoking peer process. The message error implementation requires you to select a business exception. If your project does not define business exceptions, then you must create a business exception. For more information about business exceptions, see Section 19.2, Using Business Exceptions . To handle errors in a peer process using message events: 1. Edit the peer BPMN process.

2. Add a message end or throw event.

3. Add a sequence flow from the flow object that can produce an error to the message

end event. Note: You must always define a path for the instance to follow if there are no error. If you do not define a path for the case where there are no errors the project does not build successfully.