Error handling
Dedicated flows are established in the proxy to manage errors in API development. When a policy in the regular flow generates an error, it triggers the API error flow, leading to the exit of the normal pipeline. While most policies trigger a default fault error response, there are instances where customization is necessary. For example, you may want to return a different status code or error message.
Flows in error handling
DefaultFaultRule
The defaultFaultRule functions as the default flow in the event of an error, as its name implies. When the 'AlwaysEnforce' tag is set to true, this flow is executed even if other user-configured fault rules are present. Positioned as a specific flow, it can be configured in the Proxy Endpoint or Target Endpoint as the last element before the conclusion of the Proxy or Target. This flow serves various purposes, such as setting custom general error messages or error codes when no other error is returned. Additionally, it can be utilized to return errors in a specific format.
Example
<defaultFaultRule name="default-fault">
<step>
<Name>JS_loggingReqRes</Name>
</Step>
</defaultFaultRule>