Skip to main content

Error Handling

The plug-in interprets a template handlers response as valid when:

  • the valid JSON is printed to the browser buffer
  • the HTTP status code is set to200

When these conditions are unmet, the plug-in interprets a template handler response as invalid and displays an error message depending on the error raised while performing the request.

Valid JSON objects for each handler are described in the RESTful Service \ Resource templates.

This document covers the following errors displayed to the end user:

  • Invalid access token
  • Unhandled PL/SQL Error
  • Output JSON is missing
  • Output JSON can't be parsed
  • Custom error message
  • Output JSON without error property

Custom error message

To display a custom error message, a template handler has to:

  • set HTTP status code other than 200
  • print a JSON object with an error property set with a custom message.

Custom error message can notify the end-user that his request was terminated for the given reason.

The plug-in displays a custom error message using the output JSON error property. As a result, the plug-in displays the given error message, as in the screenshot below.

image-20230306142402370

The error message Custom error message is displayed based on the error property set in the output JSON printed to the output buffer.

image-20230306144316995

Invalid access token

When the access token passes to a template handler is invalid, the plug-in displays the error message as in the screenshot below.

The access token is valid when successfully decoded, and the defined validity time is not exceeded.

image-20230306123035281

Unhandled PL/SQL Error

When a template handler raises an unhandled PL/SQL error, the plug-in displays the PL/SQL error message, as presented in the screenshot below.

image-20230306123940942

Output JSON is missing

When a template handler succeeds but the output buffer doesn't include a JSON object, the plug-in displays an error, as in the screenshot below.

image-20230306142215332

Output JSON can't be parsed

The plug-in displays an error message when the handler output JSON can't be parsed, as in the screenshot below.

image-20230306125718667

To learn more about the reason, open a browser console and inspect the request in a browser console network tab.

image-20230306125815107

Output JSON without error property

When a template handler sets an HTTP status code other than 200, and the output JSON is included without the error property, the plug-in displays an error, as in the screenshot below.

image-20230306143710756

In this case, the error is raised because a template handler returned JSON with the property errorMessage (which is not supported by the plug-in), and the supported error property is not included.

image-20230306144120100