Contents

Popular

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Expand
titleContents

Table of Contents
indent15px
stylenone

Use Case

The This example demonstrates the way errors from target servers can be handled and customized using the rules Rules and Fault Handling policy. Consider a case where When the backend API which returns JSON sends an HTML page when the resource is not available. The , the client JSON parsers could fail to interpret the responses. Using Fault Handling policy, the response can be customized so that a 500 (Internal Server Error) is sent in predefined JSON format.

...

Fault Handling Policy needs to be added as explained in the Adding a Policy section.

Assigning Rule

A rule needs to be assigned to the policy so that the policy gets executed on certain conditions. Error codes 404 (Not Found) and 500 (Internal Error) are used in this example. Since these errors are mostly due to issues with the back end APIs and cannot be controlled by the API user, an appropriate error message is sent to the client reporting the issue.

...

The error is customized so that the 404 HTML page returned by backend server is replaced by a JSON response and . An HTTP 500 response code which corresponds to the internal error at the API Proxy Server. The status code, status phrase and the message to be sent back to the client can be customized as part of the Fault Handling Policy configuration as shown below.

Adaptavist ThemeBuilder EngineAtlassian Confluence