Handling errors in a process
Capturing errors and exceptions using Error Boundary event
An Error Boundary event is always placed on the boundary of the Activities elements, such as Call Activity, User Task, Sub-Process, Service Task, or Receive Task element. For example, if you add the Error Boundary event on the boundary of a Sub-Process element, all the errors and exceptions generated from the child processes and all of their descendant process definitions are captured by the Error Boundary event.
The Error Boundary event captures the following errors and exceptions:
Error/Exception | Description |
---|---|
Business errors | Business errors are the logical errors occurring within a process that cause the process to operate incorrectly or produce incorrect results. For example, assigning a value to the wrong variable produces an incorrect result. Business errors are captured only on Call Activity and Sub-Process and are displayed using the Error End event in a process or subprocess. If you add an Error Boundary event on the boundary of a Call Activity element or a Sub-Process element, you can configure the business error to be captured by the Error Boundary event. |
Java exception | Instances of different Java exceptions are generated during the runtime process. For example, when creating a User Task record, if you do not provide the required field values, RxFrameworkException is generated. |
Use the Error Boundary event to:
- Add multiple Error Boundary events to an activity.
- If you configure an activity with multiple Error Boundary events, the Error Boundary event configured for capturing specific errors and exceptions takes precedence over the Error Boundary event configured for capturing generic business errors and exceptions.
- Capture unique errors or exceptions. No two Error Boundary events capture the same error or Java exception with the same error number.
- Provide a fully qualified name for an exception if you want to capture a specific exception.
To add an Error Boundary event in a process
- Open the process in which you want to add the Error Boundary event.
- Log in to BMC Helix Innovation Studio and navigate to the Workspace tab.
- Select the application in which your process exists.
- In the application, click the Processes tab.
- Click the process name to which you want to add events.
The Process designer opens and displays the process on the canvas.
- Add the Error Boundary event to the process.
- On the canvas, drag an Error Boundary event on the boundary of any of the Activities elements, for example, a Call Activity element or a Sub-Process element, according to the process requirement.
- In the Properties pane, enter the description and select Add/Remove Errors.
The Add/Remove Errors UI allows you to capture the errors and exceptions based on the following options:- All Business Errors – To capture all the errors from Call Activity or Sub-Process elements.
- Specific Business Error – To capture those errors that are from only Call Activity or Sub-Process elements defined for the task.
- All Exceptions – To capture all the Java exceptions generated by the process.
- Specific Exceptions – To capture only the specifically mentioned exceptions.
- Click Save.
Accessing errors captured by Error Boundary events
You can access the following details of an error captured by an Error Boundary event:
- Business errors—Error message
- Java exceptions—Error message, error number, and exception class
If there are multiple Error Boundary events, you can configure all the events individually.
To access error details captured by Error Boundary events
- Open the process in which you have the Error Boundary event.
- Log in to BMC Helix Innovation Studio and navigate to the Workspace tab.
- Select the application in which your process exists.
- In the application, click Processes.
- Click the process name from which you want to get access the error details.
- Drag the appropriate user message Service Task (Send message, Send Message by Template, or Show Alert) to the canvas and place it at that point of the process flow where you want to send the error details.
- In the Properties pane, select the parameter in which you want to send the error details such as Body (for Send message and Send Message by Template) or Alert text (for Show Alert).
- Click Click to build an expression.
- In the Errors node, select the error message, exception class, and error number (for Java exception error), or error message (for business error) caught by the Error Boundary event, as shown in the following image:
- Click OK to save the process.
Displaying errors using Error End events
An Error End event indicates a business error in a process. The relevant Error Boundary event captures this Business error. If no Error Boundary event is found to capture the business error, the error is displayed to the user.
An error message is defined as a business error! The error message is an expression that refers to context data, for example, a process variable, a result of an activity, or a keyword. The expression in the error message is evaluated when the process generates a Business error.
To add an Error End event to a process
- Open the process in which you want to add the Error End event.
- Log in to BMC Helix Innovation Studio and navigate to the Workspace tab.
- Select the application in which your process exists.
- In the application, click the Processes tab.
- Click the process name where you want to add events.
The Process designer opens and displays the process on the canvas.
- Add the Error End event to the process.
- On the canvas, drag an Error End event.
- In the Properties pane, type a label and description.
- From INPUT MAP, select Click to build an expression.
With Click to build an expression, you create an expression for an error message, which will be displayed at runtime.
- Click Save.
Example of using Error Boundary and Error End events in a process
The following image depicts a sample process of reviewing a new sales lead for an organization. The Error End events are used in this process to display the errors generated during process execution. The Error Boundary event is used to capture the errors and exceptions generated during the process execution.
The following table describes the stages of this process example:
Stage | Description |
---|---|
1 | The Provide new sales lead User Task is for a sales representative to provide information for the new sales lead. |
2 | The new sales lead information is sent to the Review sales lead subprocess. |
3 | The Review customer rating User Task is for the sales representative to provide information for reviewing the customer rating. |
4 | The Review profitability User Task is for the sales representative to provide the profitability information related to the new sales lead. |
5 | After the Review profitability User Task is completed, if sufficient information to review the profitability is not provided, the following business error is generated: Insufficient data to review profitability. |
6 | An Error Boundary event captures the Insufficient data to review profitability business error, provides additional information for the sales lead, and restarts the Review sales lead subprocess. |
7 | A second Error Boundary event captures all the exceptions and sends a message to an administrator. |
8 |
If the Review sales lead subprocess is completed successfully without generating any Business errors or exceptions, the Store lead in CRM system action stores the new sales lead in the CRM system.