throw
Use the throw policy to throw an error when it is reached during the execution of an assembly flow.
Gateway support
Gateway | Policy version |
---|---|
DataPower® Gateway (v5 compatible) | 1.0.0 |
DataPower API Gateway | 2.0.0 2.1.0 (DataPower API Gateway Version 10.0.3.0 or later) |
This topic describes how to configure the policy in the assembly user interface; for details on how to configure the policy in your OpenAPI source, see throw.
When the throw policy is encountered, the specified error and error message is produced.
If a catch has been configured that the error produced by the throw policy fulfills, the catch will be triggered.
If no catch is triggered by the thrown error, then a 500 Internal Server Error is returned to the API caller.
Component property details
You can configure a component's properties in the property sheet in the assemble view.
Property | Required | Description |
---|---|---|
Title | No | A custom title for your component when it is displayed in the canvas. If a title is not
specified, throw is used by default. |
Error name | Yes | The error name that is thrown by the policy. |
![]() |
No | Specify the HTTP status code for the error. You can use the $(variable)
format to reference the error.status.code API context variable. |
![]() |
No | Specify the HTTP reason phrase for the error. You can use the $(variable)
format to reference the error.status.reason API context variable. |
Error message | No | The error message that is returned with the error name. |