npmdoc-boom
v0.0.4
Published
api documentation for [boom (v4.3.1)](https://github.com/hapijs/boom#readme) [![npm package](https://img.shields.io/npm/v/npmdoc-boom.svg?style=flat-square)](https://www.npmjs.org/package/npmdoc-boom) [![travis-ci.org build-status](https://api.travis-ci.o
Downloads
3
Readme
api documentation for boom (v4.3.1)
HTTP-friendly error objects
package.json
{
"bugs": {
"url": "https://github.com/hapijs/boom/issues"
},
"dependencies": {
"hoek": "4.x.x"
},
"description": "HTTP-friendly error objects",
"devDependencies": {
"code": "4.x.x",
"lab": "13.x.x",
"markdown-toc": "0.12.x"
},
"directories": {},
"dist": {
"shasum": "4f8a3005cb4a7e3889f749030fd25b96e01d2e31",
"tarball": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz"
},
"engines": {
"node": ">=4.0.0"
},
"gitHead": "3d30c69faf6733a1604b400df71ed4781799a032",
"homepage": "https://github.com/hapijs/boom#readme",
"keywords": [
"error",
"http"
],
"license": "BSD-3-Clause",
"main": "lib/index.js",
"maintainers": [
{
"name": "hueniverse"
},
{
"name": "wyatt"
},
{
"name": "arb"
}
],
"name": "boom",
"optionalDependencies": {},
"repository": {
"type": "git",
"url": "git://github.com/hapijs/boom.git"
},
"scripts": {
"test": "lab -a code -t 100 -L -v",
"test-cov-html": "lab -a code -r html -o coverage.html -L",
"toc": "node generate-toc.js",
"version": "npm run toc && git add README.md"
},
"version": "4.3.1"
}
table of contents
module boom
- function boom.badData (message, data)
- function boom.badGateway (message, data)
- function boom.badImplementation (message, data)
- function boom.badRequest (message, data)
- function boom.clientTimeout (message, data)
- function boom.conflict (message, data)
- function boom.create (statusCode, message, data)
- function boom.entityTooLarge (message, data)
- function boom.expectationFailed (message, data)
- function boom.forbidden (message, data)
- function boom.gatewayTimeout (message, data)
- function boom.illegal (message, data)
- function boom.internal (message, data, statusCode)
- function boom.lengthRequired (message, data)
- function boom.locked (message, data)
- function boom.methodNotAllowed (message, data, allow)
- function boom.notAcceptable (message, data)
- function boom.notFound (message, data)
- function boom.notImplemented (message, data)
- function boom.paymentRequired (message, data)
- function boom.preconditionFailed (message, data)
- function boom.preconditionRequired (message, data)
- function boom.proxyAuthRequired (message, data)
- function boom.rangeNotSatisfiable (message, data)
- function boom.resourceGone (message, data)
- function boom.serverUnavailable (message, data)
- function boom.teapot (message, data)
- function boom.tooManyRequests (message, data)
- function boom.unauthorized (message, scheme, attributes)
- function boom.unsupportedMediaType (message, data)
- function boom.uriTooLong (message, data)
- function boom.wrap (error, statusCode, message)
module boom
function boom.badData (message, data)
- description and source-code
badData = function (message, data) {
return internals.create(422, message, data, exports.badData);
}
- example usage
...
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
...
function boom.badGateway (message, data)
- description and source-code
badGateway = function (message, data) {
return internals.serverError(message, data, 502, exports.badGateway);
}
- example usage
...
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
- ['Boom.gatewayTimeout([message], [data])'](#boomgatewaytimeoutmessage-data)
- [F.A.Q.](#faq)
<!-- tocstop -->
# Boom
...
function boom.badImplementation (message, data)
- description and source-code
badImplementation = function (message, data) {
const err = internals.serverError(message, data, 500, exports.badImplementation);
err.isDeveloperError = true;
return err;
}
- example usage
...
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
- ['Boom.gatewayTimeout([message], [data])'](#boomgatewaytimeoutmessage-data)
- [F.A.Q.](#faq)
<!-- tocstop -->
...
function boom.badRequest (message, data)
- description and source-code
badRequest = function (message, data) {
return internals.create(400, message, data, exports.badRequest);
}
- example usage
...
<!-- toc -->
- [Boom](#boom)
- [Helper Methods](#helper-methods)
- ['wrap(error, [statusCode], [message])'](#wraperror-statuscode-message)
- ['create(statusCode, [message], [data])'](#createstatuscode-message-data)
- [HTTP 4xx Errors](#http-4xx-errors)
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
...
function boom.clientTimeout (message, data)
- description and source-code
clientTimeout = function (message, data) {
return internals.create(408, message, data, exports.clientTimeout);
}
- example usage
...
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
...
function boom.conflict (message, data)
- description and source-code
conflict = function (message, data) {
return internals.create(409, message, data, exports.conflict);
}
- example usage
...
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
...
function boom.create (statusCode, message, data)
- description and source-code
create = function (statusCode, message, data) {
return internals.create(statusCode, message, data, exports.create);
}
- example usage
...
Generates an 'Error' object with the **boom** decorations where:
- 'statusCode' - an HTTP error code number. Must be greater or equal 400.
- 'message' - optional message string.
- 'data' - additional error data set to 'error.data' property.
'''js
var error = Boom.create(400, 'Bad request', { timestamp: Date.now() });
'''
## HTTP 4xx Errors
### 'Boom.badRequest([message], [data])'
Returns a 400 Bad Request error where:
...
function boom.entityTooLarge (message, data)
- description and source-code
entityTooLarge = function (message, data) {
return internals.create(413, message, data, exports.entityTooLarge);
}
- example usage
...
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
...
function boom.expectationFailed (message, data)
- description and source-code
expectationFailed = function (message, data) {
return internals.create(417, message, data, exports.expectationFailed);
}
- example usage
...
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
...
function boom.forbidden (message, data)
- description and source-code
forbidden = function (message, data) {
return internals.create(403, message, data, exports.forbidden);
}
- example usage
...
- [Helper Methods](#helper-methods)
- ['wrap(error, [statusCode], [message])'](#wraperror-statuscode-message)
- ['create(statusCode, [message], [data])'](#createstatuscode-message-data)
- [HTTP 4xx Errors](#http-4xx-errors)
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
...
function boom.gatewayTimeout (message, data)
- description and source-code
gatewayTimeout = function (message, data) {
return internals.serverError(message, data, 504, exports.gatewayTimeout);
}
- example usage
...
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
- ['Boom.gatewayTimeout([message], [data])'](#boomgatewaytimeoutmessage-data)
- [F.A.Q.](#faq)
<!-- tocstop -->
# Boom
**boom** provides a set of utilities for returning HTTP errors. Each utility returns a 'Boom' error response
...
function boom.illegal (message, data)
- description and source-code
illegal = function (message, data) {
return internals.create(451, message, data, exports.illegal);
}
- example usage
...
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
- ['Boom.gatewayTimeout([message], [data])'](#boomgatewaytimeoutmessage-data)
- [F.A.Q.](#faq)
...
function boom.internal (message, data, statusCode)
- description and source-code
internal = function (message, data, statusCode) {
return internals.serverError(message, data, statusCode, exports.internal);
}
- example usage
n/a
function boom.lengthRequired (message, data)
- description and source-code
lengthRequired = function (message, data) {
return internals.create(411, message, data, exports.lengthRequired);
}
- example usage
...
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
...
function boom.locked (message, data)
- description and source-code
locked = function (message, data) {
return internals.create(423, message, data, exports.locked);
}
- example usage
...
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
...
function boom.methodNotAllowed (message, data, allow)
- description and source-code
methodNotAllowed = function (message, data, allow) {
const err = internals.create(405, message, data, exports.methodNotAllowed);
if (typeof allow === 'string') {
allow = [allow];
}
if (Array.isArray(allow)) {
err.output.headers.Allow = allow.join(', ');
}
return err;
}
- example usage
...
- ['create(statusCode, [message], [data])'](#createstatuscode-message-data)
- [HTTP 4xx Errors](#http-4xx-errors)
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
...
function boom.notAcceptable (message, data)
- description and source-code
notAcceptable = function (message, data) {
return internals.create(406, message, data, exports.notAcceptable);
}
- example usage
...
- [HTTP 4xx Errors](#http-4xx-errors)
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
...
function boom.notFound (message, data)
- description and source-code
notFound = function (message, data) {
return internals.create(404, message, data, exports.notFound);
}
- example usage
...
- ['wrap(error, [statusCode], [message])'](#wraperror-statuscode-message)
- ['create(statusCode, [message], [data])'](#createstatuscode-message-data)
- [HTTP 4xx Errors](#http-4xx-errors)
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
...
function boom.notImplemented (message, data)
- description and source-code
notImplemented = function (message, data) {
return internals.serverError(message, data, 501, exports.notImplemented);
}
- example usage
...
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
- ['Boom.gatewayTimeout([message], [data])'](#boomgatewaytimeoutmessage-data)
- [F.A.Q.](#faq)
<!-- tocstop -->
...
function boom.paymentRequired (message, data)
- description and source-code
paymentRequired = function (message, data) {
return internals.create(402, message, data, exports.paymentRequired);
}
- example usage
...
- [Boom](#boom)
- [Helper Methods](#helper-methods)
- ['wrap(error, [statusCode], [message])'](#wraperror-statuscode-message)
- ['create(statusCode, [message], [data])'](#createstatuscode-message-data)
- [HTTP 4xx Errors](#http-4xx-errors)
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
...
function boom.preconditionFailed (message, data)
- description and source-code
preconditionFailed = function (message, data) {
return internals.create(412, message, data, exports.preconditionFailed);
}
- example usage
...
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
...
function boom.preconditionRequired (message, data)
- description and source-code
preconditionRequired = function (message, data) {
return internals.create(428, message, data, exports.preconditionRequired);
}
- example usage
...
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
...
function boom.proxyAuthRequired (message, data)
- description and source-code
proxyAuthRequired = function (message, data) {
return internals.create(407, message, data, exports.proxyAuthRequired);
}
- example usage
...
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
...
function boom.rangeNotSatisfiable (message, data)
- description and source-code
rangeNotSatisfiable = function (message, data) {
return internals.create(416, message, data, exports.rangeNotSatisfiable);
}
- example usage
...
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
...
function boom.resourceGone (message, data)
- description and source-code
resourceGone = function (message, data) {
return internals.create(410, message, data, exports.resourceGone);
}
- example usage
...
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
...
function boom.serverUnavailable (message, data)
- description and source-code
serverUnavailable = function (message, data) {
return internals.serverError(message, data, 503, exports.serverUnavailable);
}
- example usage
...
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
- ['Boom.gatewayTimeout([message], [data])'](#boomgatewaytimeoutmessage-data)
- [F.A.Q.](#faq)
<!-- tocstop -->
# Boom
...
function boom.teapot (message, data)
- description and source-code
teapot = function (message, data) {
return internals.create(418, message, data, exports.teapot);
}
- example usage
...
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
...
function boom.tooManyRequests (message, data)
- description and source-code
tooManyRequests = function (message, data) {
return internals.create(429, message, data, exports.tooManyRequests);
}
- example usage
...
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
- ['Boom.illegal([message], [data])'](#boomillegalmessage-data)
- [HTTP 5xx Errors](#http-5xx-errors)
- ['Boom.badImplementation([message], [data])' - (*alias: 'internal'*)](#boombadimplementationmessage-data---alias-internal)
- ['Boom.notImplemented([message], [data])'](#boomnotimplementedmessage-data)
- ['Boom.badGateway([message], [data])'](#boombadgatewaymessage-data)
- ['Boom.serverUnavailable([message], [data])'](#boomserverunavailablemessage-data)
- ['Boom.gatewayTimeout([message], [data])'](#boomgatewaytimeoutmessage-data)
...
function boom.unauthorized (message, scheme, attributes)
- description and source-code
unauthorized = function (message, scheme, attributes) { // Or function (message, wwwAuthenticate[])
const err = internals.create(401, message, undefined, exports.unauthorized);
if (!scheme) {
return err;
}
let wwwAuthenticate = '';
if (typeof scheme === 'string') {
// function (message, scheme, attributes)
wwwAuthenticate = scheme;
if (attributes || message) {
err.output.payload.attributes = {};
}
if (attributes) {
if (typeof attributes === 'string') {
wwwAuthenticate = wwwAuthenticate + ' ' + Hoek.escapeHeaderAttribute(attributes);
err.output.payload.attributes = attributes;
}
else {
const names = Object.keys(attributes);
for (let i = 0; i < names.length; ++i) {
const name = names[i];
if (i) {
wwwAuthenticate = wwwAuthenticate + ',';
}
let value = attributes[name];
if (value === null ||
value === undefined) { // Value can be zero
value = '';
}
wwwAuthenticate = wwwAuthenticate + ' ' + name + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
err.output.payload.attributes[name] = value;
}
}
}
if (message) {
if (attributes) {
wwwAuthenticate = wwwAuthenticate + ',';
}
wwwAuthenticate = wwwAuthenticate + ' error="' + Hoek.escapeHeaderAttribute(message) + '"';
err.output.payload.attributes.error = message;
}
else {
err.isMissing = true;
}
}
else {
// function (message, wwwAuthenticate[])
const wwwArray = scheme;
for (let i = 0; i < wwwArray.length; ++i) {
if (i) {
wwwAuthenticate = wwwAuthenticate + ', ';
}
wwwAuthenticate = wwwAuthenticate + wwwArray[i];
}
}
err.output.headers['WWW-Authenticate'] = wwwAuthenticate;
return err;
}
- example usage
...
- [Boom](#boom)
- [Helper Methods](#helper-methods)
- ['wrap(error, [statusCode], [message])'](#wraperror-statuscode-message)
- ['create(statusCode, [message], [data])'](#createstatuscode-message-data)
- [HTTP 4xx Errors](#http-4xx-errors)
- ['Boom.badRequest([message], [data])'](#boombadrequestmessage-data)
- ['Boom.unauthorized([message], [scheme], [attributes])'](#boomunauthorizedmessage-scheme-attributes)
- ['Boom.paymentRequired([message], [data])'](#boompaymentrequiredmessage-data)
- ['Boom.forbidden([message], [data])'](#boomforbiddenmessage-data)
- ['Boom.notFound([message], [data])'](#boomnotfoundmessage-data)
- ['Boom.methodNotAllowed([message], [data], [allow])'](#boommethodnotallowedmessage-data-allow)
- ['Boom.notAcceptable([message], [data])'](#boomnotacceptablemessage-data)
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
...
function boom.unsupportedMediaType (message, data)
- description and source-code
unsupportedMediaType = function (message, data) {
return internals.create(415, message, data, exports.unsupportedMediaType);
}
- example usage
...
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
- ['Boom.tooManyRequests([message], [data])'](#boomtoomanyrequestsmessage-data)
...
function boom.uriTooLong (message, data)
- description and source-code
uriTooLong = function (message, data) {
return internals.create(414, message, data, exports.uriTooLong);
}
- example usage
...
- ['Boom.proxyAuthRequired([message], [data])'](#boomproxyauthrequiredmessage-data)
- ['Boom.clientTimeout([message], [data])'](#boomclienttimeoutmessage-data)
- ['Boom.conflict([message], [data])'](#boomconflictmessage-data)
- ['Boom.resourceGone([message], [data])'](#boomresourcegonemessage-data)
- ['Boom.lengthRequired([message], [data])'](#boomlengthrequiredmessage-data)
- ['Boom.preconditionFailed([message], [data])'](#boompreconditionfailedmessage-data)
- ['Boom.entityTooLarge([message], [data])'](#boomentitytoolargemessage-data)
- ['Boom.uriTooLong([message], [data])'](#boomuritoolongmessage-data)
- ['Boom.unsupportedMediaType([message], [data])'](#boomunsupportedmediatypemessage-data)
- ['Boom.rangeNotSatisfiable([message], [data])'](#boomrangenotsatisfiablemessage-data)
- ['Boom.expectationFailed([message], [data])'](#boomexpectationfailedmessage-data)
- ['Boom.teapot([message], [data])'](#boomteapotmessage-data)
- ['Boom.badData([message], [data])'](#boombaddatamessage-data)
- ['Boom.locked([message], [data])'](#boomlockedmessage-data)
- ['Boom.preconditionRequired([message], [data])'](#boompreconditionrequiredmessage-data)
...
function boom.wrap (error, statusCode, message)
- description and source-code
wrap = function (error, statusCode, message) {
Hoek.assert(error instanceof Error, 'Cannot wrap non-Error object');
Hoek.assert(!error.isBoom || (!statusCode && !message), 'Cannot provide statusCode or message with boom error');
return (error.isBoom ? error : internals.initialize(error, statusCode || 500, message));
}
- example usage
...
- 'error' - the error object to wrap. If 'error' is already a **boom** object, returns back the same object.
- 'statusCode' - optional HTTP status code. Defaults to '500'.
- 'message' - optional message string. If the error already has a message, it adds the message as a prefix.
Defaults to no message.
'''js
var error = new Error('Unexpected input');
Boom.wrap(error, 400);
'''
### 'create(statusCode, [message], [data])'
Generates an 'Error' object with the **boom** decorations where:
- 'statusCode' - an HTTP error code number. Must be greater or equal 400.
- 'message' - optional message string.
...
misc
- this document was created with utility2