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
errorproperty 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.
The error message Custom error message is displayed based on the
error property set in the output JSON printed to the output buffer.
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.
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.
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.
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.
To learn more about the reason, open a browser console and inspect the request in a browser console network tab.
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.
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.