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:
-
If you have not previously pinned the UI navigation pane then
click the Navigate to icon .
The
API Manager UI navigation pane opens. To pin the
UI navigation pane, click the
Pin menu icon
.
-
Click Drafts in the UI navigation pane, and then click APIs.
The APIs tab opens.
-
Click APIs.
The APIs tab opens.
-
Click the API definition that you want to apply a catch to and then click the
Assemble tab.
-
Set the Show catches toggle in the menu bar above the palette to the
Show position.
-
Click Catch at the bottom of the canvas, or a
Catch icon if one is displayed.
The property sheet for the API's catches opens.
-
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.
-
To add a new catch, click + Catch.
-
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.
- Optional:
To remove an error case from a catch, click the corresponding cross.
- Optional:
To change the precedence of your catches, use Move up
or Move down
icons.
If an error case is handled by multiple catches, the catch at the top of the list is
applied.
-
To add a component to a catch, drag the component over the dashed, gray box that appears in the
flow from 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.