You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+7-8Lines changed: 7 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -249,15 +249,15 @@ function onUnknownRoute(request) {
249
249
If a different error format than the default JSON response is required, the server `errors.format` option can be assigned a function to generate a
250
250
different error response. The function signature is _'function (result, callback)'_ where:
251
251
-_'result'_ - is the **hapi** error object returned by the route handler, and
252
-
-_'callback'_ - is the callback function called with the new result object or string.
252
+
-_'callback'_ - is a callback function called with the formatted response. The callback function signature is _'function (code, payload, contentType)'_.
-_'internal([message, data])'_ - HTTP 500 (Internal error). The optional _message_ and _data_ values are not returned to the client but are logged internally.
709
-
-_'create(message, code, text, [options]) - creates a custom error with the provided _message_, _code_ (the HTTP status code), _text_ (the HTTP status message), and any keys present in _options_.
-_'internal([message, data])'_ - HTTP 500 (Internal Error). The optional _message_ and _data_ values are not returned to the client but are logged internally.
710
709
711
710
The _message_ value is optional and will be returned to the client in the response unless noted otherwise. For example:
712
711
@@ -719,7 +718,7 @@ function onUnknownRoute(request) {
719
718
720
719
Error responses are send as JSON payload with the following keys (unless an [error response override](#errors) is configured):
721
720
-_code_ - the HTTP status code (e.g. 400).
722
-
-_error_ - the HTTP status message (e.g. 'Bad request').
721
+
-_error_ - the HTTP status message (e.g. 'Bad Request').
723
722
-_message_ - the returned message if provided.
724
723
725
724
The complete error repsonse including any additional data is added to the request log.
0 commit comments