Handling errors in client-side human services

To catch errors in client-side human services, you can use intermediate events that can be attached to service nodes.

About this task

When you attach it to a service node, the intermediate event becomes an error boundary event that catches errors and receives error data from the service to which it is attached. The error boundary event is triggered while the service is running and interrupts its execution.
Tip: If you want to have different error handling logic for different errors, define multiple error boundary events on the single service node. For each error boundary event, use different error codes or error data to differentiate between the different kinds of errors. Then, connect each one to the error handling logic that applies.
Table 1. Usage of error events in client-side human services
Icon Error event Description
This icon indicates the Error boundary event tool on the palette for client-side human services. Error boundary event that is attached to a service node in a client-side human service Catches errors and receives error data from the service to which it is attached.
When you plan to use error events in your client-side human service, consider the following points:
  • You can attach error boundary events only to service nodes in your client-side human service.
  • You can reposition an error boundary event inside the service, you can remove it from the service, or you can move it to another service. In client-side human services, the error boundary event cannot exist as a stand-alone error event outside of a service node.
  • Consider specifying the error properties to catch specific errors, filtering on the error code for the types of errors that are caught, and mapping to a variable after the errors are caught.
    • The error event information is captured in the tw.error.code and tw.error.data variables.
    • By mapping the error boundary event to a variable, events with incompatible data types are filtered out and the data is captured in a local variable.
    For reference information, see JavaScript API for client-side human service authoring.

Procedure

To add an error boundary event to a service in a client-side human service:

  1. Open the Process Designer desktop editor.
  2. Open the client-side human service that you want to work with.
  3. In the Diagram view, drag the Intermediate event tool Intermediate event tool and drop it onto the service node that you want to attach it to. The intermediate event changes into an error boundary event Error boundary event that is attached to the boundary of the service.
    An example of error boundary event implementation in a client-side human service. The diagram shows a service flow that consists of a start event, a coach, a service, and an end event. The service node has an error boundary event that is attached to it.
  4. Select the error boundary event and, in its Implementation tab, under Event Properties, select Catch all errors or Catch specific errors to specify what type of errors you want the error event to catch.
  5. If you selected Catch specific errors, click the pickers next to Error code and Error mapping to filter on the error code for the specific errors that can be caught, and map the error data to a local variable.
  6. Connect the error boundary event to the logic you want to run when the error occurs. For example, you can connect it to a coach that displays an error message to a user.
  7. Click Save all to save the configuration.