Handling errors in the assembly

Use the catch section of the assembly to describe the handling of errors thrown during the assembly execution.

About this task

You can complete this task either by using either the API Designer UI application, or by using the browser based API Manager UI.

The catch section of the assembly is used to implement an assembly in the instance that an error is thrown during the assembly execution. For example, the assembly could contain a throw component, the API caller could fail to authenticate, or a policy could fail to execute correctly. Each error can be handled with a different catch and each catch can handle multiple status errors.

Procedure

To create a catch and include components in it, complete the following steps:

  1. In the navigation pane, click Develop icon in the navigation pane Develop.
    The Develop: APIs and Products tab opens.
  2. Click the API definition that you want to apply a catch to, and then click the Assemble tab at the top of the Develop API editor.
  3. Set the Show catches toggle in the menu bar above the canvas to the Show position.
  4. Click Catch at the bottom of the canvas, or a Catch icon The Catch icon if one is displayed.
    The property sheet for the API's catches opens.
  5. To add a default catch that is executed when an otherwise uncaught error is thrown, click + Default.
    Note: If you have a default catch above another catch in precedence, the default catch will activate even when the other catch's error is thrown.
  6. To add a new catch, click + Catch.
  7. To specify which errors the catch applies to, type the name of a custom error and press Enter, or use the search errors field to search for the appropriate error.
  8. Optional: To remove an error case from a catch, click the corresponding cross.
  9. Optional: To change the precedence of your catches, use the Move up The Move up icon or Move down The Move down icon icons.
    If an error case is handled by multiple catches, the catch at the top of the list is applied.
  10. To add a component to a catch, drag the component over the dashed, gray box that appears in the flow from the Catch icon The Catch icon for the catch that you want to apply the component to.
  11. Click Save to save your changes.

What to do next

If you added a catch for ConnectionError, SOAPError, or OperationError, you must add the same error to the Stop on error setting for the Invoke policy in your assembly. otherwise if the error occurs during the execution of the Invoke policy, it is not caught, the policy execution is allowed to complete, and the assembly flow continues. For details on configuring an Invoke policy, see Invoke.