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

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. If you have not previously pinned the UI navigation pane then click the Navigate to icon The Navigate to icon.
    The API Manager UI navigation pane opens. To pin the UI navigation pane, click the Pin menu icon The Pin menu icon..
  2. Click Drafts in the UI navigation pane, and then click APIs.
    The APIs tab opens.
  3. Click APIs.
    The APIs tab opens.
  4. Click the API definition that you want to apply a catch to and then click the Assemble tab.
  5. Set the Show catches toggle in the menu bar above the palette to the Show position.
  6. 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.
  7. 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.
  8. To add a new catch, click + Catch.
  9. 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.
  10. Optional: To remove an error case from a catch, click the corresponding cross.
  11. Optional: To change the precedence of your catches, use 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.
  12. 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 you want to apply the component to.

Results

You have created and added components to a catch for handling errors.