{ "_args": [ [ { "raw": "boom@4.x.x", "scope": null, "escapedName": "boom", "name": "boom", "rawSpec": "4.x.x", "spec": ">=4.0.0 <5.0.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/hawk" ] ], "_from": "boom@>=4.0.0 <5.0.0", "_id": "boom@4.3.1", "_inCache": true, "_location": "/boom", "_nodeVersion": "7.6.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", "tmp": "tmp/boom-4.3.1.tgz_1490708346910_0.7436342970468104" }, "_npmUser": { "name": "arb", "email": "arbretz@gmail.com" }, "_npmVersion": "4.4.1", "_phantomChildren": {}, "_requested": { "raw": "boom@4.x.x", "scope": null, "escapedName": "boom", "name": "boom", "rawSpec": "4.x.x", "spec": ">=4.0.0 <5.0.0", "type": "range" }, "_requiredBy": [ "/hawk" ], "_resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", "_shasum": "4f8a3005cb4a7e3889f749030fd25b96e01d2e31", "_shrinkwrap": null, "_spec": "boom@4.x.x", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/hawk", "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", "email": "eran@hueniverse.com" }, { "name": "wyatt", "email": "wpreul@gmail.com" }, { "name": "arb", "email": "arbretz@gmail.com" } ], "name": "boom", "optionalDependencies": {}, "readme": "![boom Logo](https://raw.github.com/hapijs/boom/master/images/boom.png)\n\nHTTP-friendly error objects\n\n[![Build Status](https://secure.travis-ci.org/hapijs/boom.svg)](http://travis-ci.org/hapijs/boom)\n[![Current Version](https://img.shields.io/npm/v/boom.svg)](https://www.npmjs.com/package/boom)\n\nLead Maintainer: [Adam Bretz](https://github.com/arb)\n\n\n\n- [Boom](#boom)\n - [Helper Methods](#helper-methods)\n - [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message)\n - [`create(statusCode, [message], [data])`](#createstatuscode-message-data)\n - [HTTP 4xx Errors](#http-4xx-errors)\n - [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data)\n - [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes)\n - [`Boom.paymentRequired([message], [data])`](#boompaymentrequiredmessage-data)\n - [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data)\n - [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data)\n - [`Boom.methodNotAllowed([message], [data], [allow])`](#boommethodnotallowedmessage-data-allow)\n - [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data)\n - [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data)\n - [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data)\n - [`Boom.conflict([message], [data])`](#boomconflictmessage-data)\n - [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data)\n - [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data)\n - [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data)\n - [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data)\n - [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data)\n - [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data)\n - [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data)\n - [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data)\n - [`Boom.teapot([message], [data])`](#boomteapotmessage-data)\n - [`Boom.badData([message], [data])`](#boombaddatamessage-data)\n - [`Boom.locked([message], [data])`](#boomlockedmessage-data)\n - [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data)\n - [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data)\n - [`Boom.illegal([message], [data])`](#boomillegalmessage-data)\n - [HTTP 5xx Errors](#http-5xx-errors)\n - [`Boom.badImplementation([message], [data])` - (*alias: `internal`*)](#boombadimplementationmessage-data---alias-internal)\n - [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data)\n - [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data)\n - [`Boom.serverUnavailable([message], [data])`](#boomserverunavailablemessage-data)\n - [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data)\n - [F.A.Q.](#faq)\n\n\n\n# Boom\n\n**boom** provides a set of utilities for returning HTTP errors. Each utility returns a `Boom` error response\nobject (instance of `Error`) which includes the following properties:\n- `isBoom` - if `true`, indicates this is a `Boom` object instance.\n- `isServer` - convenience bool indicating status code >= 500.\n- `message` - the error message.\n- `output` - the formatted response. Can be directly manipulated after object construction to return a custom\n error response. Allowed root keys:\n - `statusCode` - the HTTP status code (typically 4xx or 5xx).\n - `headers` - an object containing any HTTP headers where each key is a header name and value is the header content.\n - `payload` - the formatted object used as the response payload (stringified). Can be directly manipulated but any\n changes will be lost\n if `reformat()` is called. Any content allowed and by default includes the following content:\n - `statusCode` - the HTTP status code, derived from `error.output.statusCode`.\n - `error` - the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from `statusCode`.\n - `message` - the error message derived from `error.message`.\n- inherited `Error` properties.\n\nThe `Boom` object also supports the following method:\n- `reformat()` - rebuilds `error.output` using the other object properties.\n\n## Helper Methods\n\n### `wrap(error, [statusCode], [message])`\n\nDecorates an error with the **boom** properties where:\n- `error` - the error object to wrap. If `error` is already a **boom** object, returns back the same object.\n- `statusCode` - optional HTTP status code. Defaults to `500`.\n- `message` - optional message string. If the error already has a message, it adds the message as a prefix.\n Defaults to no message.\n\n```js\nvar error = new Error('Unexpected input');\nBoom.wrap(error, 400);\n```\n\n### `create(statusCode, [message], [data])`\n\nGenerates an `Error` object with the **boom** decorations where:\n- `statusCode` - an HTTP error code number. Must be greater or equal 400.\n- `message` - optional message string.\n- `data` - additional error data set to `error.data` property.\n\n```js\nvar error = Boom.create(400, 'Bad request', { timestamp: Date.now() });\n```\n\n## HTTP 4xx Errors\n\n### `Boom.badRequest([message], [data])`\n\nReturns a 400 Bad Request error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.badRequest('invalid query');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 400,\n \"error\": \"Bad Request\",\n \"message\": \"invalid query\"\n}\n```\n\n### `Boom.unauthorized([message], [scheme], [attributes])`\n\nReturns a 401 Unauthorized error where:\n- `message` - optional message.\n- `scheme` can be one of the following:\n - an authentication scheme name\n - an array of string values. These values will be separated by ', ' and set to the 'WWW-Authenticate' header.\n- `attributes` - an object of values to use while setting the 'WWW-Authenticate' header. This value is only used\n when `scheme` is a string, otherwise it is ignored. Every key/value pair will be included in the\n 'WWW-Authenticate' in the format of 'key=\"value\"' as well as in the response payload under the `attributes` key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null.\n `null` and `undefined` will be replaced with an empty string. If `attributes` is set, `message` will be used as\n the 'error' segment of the 'WWW-Authenticate' header. If `message` is unset, the 'error' segment of the header\n will not be present and `isMissing` will be true on the error object.\n\nIf either `scheme` or `attributes` are set, the resultant `Boom` object will have the 'WWW-Authenticate' header set for the response.\n\n```js\nBoom.unauthorized('invalid password');\n```\n\nGenerates the following response:\n\n```json\n\"payload\": {\n \"statusCode\": 401,\n \"error\": \"Unauthorized\",\n \"message\": \"invalid password\"\n},\n\"headers\" {}\n```\n\n```js\nBoom.unauthorized('invalid password', 'sample');\n```\n\nGenerates the following response:\n\n```json\n\"payload\": {\n \"statusCode\": 401,\n \"error\": \"Unauthorized\",\n \"message\": \"invalid password\",\n \"attributes\": {\n \"error\": \"invalid password\"\n }\n},\n\"headers\" {\n \"WWW-Authenticate\": \"sample error=\\\"invalid password\\\"\"\n}\n```\n\n```js\nBoom.unauthorized(null, 'Negotiate', 'VGhpcyBpcyBhIHRlc3QgdG9rZW4=');\n```\n\nGenerates the following response:\n\n```json\n\"payload\": {\n \"statusCode\": 401,\n \"error\": \"Unauthorized\",\n \"attributes\": \"VGhpcyBpcyBhIHRlc3QgdG9rZW4=\"\n},\n\"headers\" {\n \"WWW-Authenticate\": \"Negotiate VGhpcyBpcyBhIHRlc3QgdG9rZW4=\"\n}\n```\n\n```js\nBoom.unauthorized('invalid password', 'sample', { ttl: 0, cache: null, foo: 'bar' });\n```\n\nGenerates the following response:\n\n```json\n\"payload\": {\n \"statusCode\": 401,\n \"error\": \"Unauthorized\",\n \"message\": \"invalid password\",\n \"attributes\": {\n \"error\": \"invalid password\",\n \"ttl\": 0,\n \"cache\": \"\",\n \"foo\": \"bar\"\n }\n},\n\"headers\" {\n \"WWW-Authenticate\": \"sample ttl=\\\"0\\\", cache=\\\"\\\", foo=\\\"bar\\\", error=\\\"invalid password\\\"\"\n}\n```\n\n### `Boom.paymentRequired([message], [data])`\n\nReturns a 402 Payment Required error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.paymentRequired('bandwidth used');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 402,\n \"error\": \"Payment Required\",\n \"message\": \"bandwidth used\"\n}\n```\n\n### `Boom.forbidden([message], [data])`\n\nReturns a 403 Forbidden error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.forbidden('try again some time');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 403,\n \"error\": \"Forbidden\",\n \"message\": \"try again some time\"\n}\n```\n\n### `Boom.notFound([message], [data])`\n\nReturns a 404 Not Found error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.notFound('missing');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 404,\n \"error\": \"Not Found\",\n \"message\": \"missing\"\n}\n```\n\n### `Boom.methodNotAllowed([message], [data], [allow])`\n\nReturns a 405 Method Not Allowed error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n- `allow` - optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header.\n\n```js\nBoom.methodNotAllowed('that method is not allowed');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 405,\n \"error\": \"Method Not Allowed\",\n \"message\": \"that method is not allowed\"\n}\n```\n\n### `Boom.notAcceptable([message], [data])`\n\nReturns a 406 Not Acceptable error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.notAcceptable('unacceptable');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 406,\n \"error\": \"Not Acceptable\",\n \"message\": \"unacceptable\"\n}\n```\n\n### `Boom.proxyAuthRequired([message], [data])`\n\nReturns a 407 Proxy Authentication Required error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.proxyAuthRequired('auth missing');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 407,\n \"error\": \"Proxy Authentication Required\",\n \"message\": \"auth missing\"\n}\n```\n\n### `Boom.clientTimeout([message], [data])`\n\nReturns a 408 Request Time-out error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.clientTimeout('timed out');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 408,\n \"error\": \"Request Time-out\",\n \"message\": \"timed out\"\n}\n```\n\n### `Boom.conflict([message], [data])`\n\nReturns a 409 Conflict error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.conflict('there was a conflict');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 409,\n \"error\": \"Conflict\",\n \"message\": \"there was a conflict\"\n}\n```\n\n### `Boom.resourceGone([message], [data])`\n\nReturns a 410 Gone error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.resourceGone('it is gone');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 410,\n \"error\": \"Gone\",\n \"message\": \"it is gone\"\n}\n```\n\n### `Boom.lengthRequired([message], [data])`\n\nReturns a 411 Length Required error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.lengthRequired('length needed');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 411,\n \"error\": \"Length Required\",\n \"message\": \"length needed\"\n}\n```\n\n### `Boom.preconditionFailed([message], [data])`\n\nReturns a 412 Precondition Failed error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.preconditionFailed();\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 412,\n \"error\": \"Precondition Failed\"\n}\n```\n\n### `Boom.entityTooLarge([message], [data])`\n\nReturns a 413 Request Entity Too Large error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.entityTooLarge('too big');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 413,\n \"error\": \"Request Entity Too Large\",\n \"message\": \"too big\"\n}\n```\n\n### `Boom.uriTooLong([message], [data])`\n\nReturns a 414 Request-URI Too Large error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.uriTooLong('uri is too long');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 414,\n \"error\": \"Request-URI Too Large\",\n \"message\": \"uri is too long\"\n}\n```\n\n### `Boom.unsupportedMediaType([message], [data])`\n\nReturns a 415 Unsupported Media Type error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.unsupportedMediaType('that media is not supported');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 415,\n \"error\": \"Unsupported Media Type\",\n \"message\": \"that media is not supported\"\n}\n```\n\n### `Boom.rangeNotSatisfiable([message], [data])`\n\nReturns a 416 Requested Range Not Satisfiable error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.rangeNotSatisfiable();\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 416,\n \"error\": \"Requested Range Not Satisfiable\"\n}\n```\n\n### `Boom.expectationFailed([message], [data])`\n\nReturns a 417 Expectation Failed error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.expectationFailed('expected this to work');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 417,\n \"error\": \"Expectation Failed\",\n \"message\": \"expected this to work\"\n}\n```\n\n### `Boom.teapot([message], [data])`\n\nReturns a 418 I'm a Teapot error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.teapot('sorry, no coffee...');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 418,\n \"error\": \"I'm a Teapot\",\n \"message\": \"Sorry, no coffee...\"\n}\n```\n\n### `Boom.badData([message], [data])`\n\nReturns a 422 Unprocessable Entity error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.badData('your data is bad and you should feel bad');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 422,\n \"error\": \"Unprocessable Entity\",\n \"message\": \"your data is bad and you should feel bad\"\n}\n```\n\n### `Boom.locked([message], [data])`\n\nReturns a 423 Locked error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.locked('this resource has been locked');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 423,\n \"error\": \"Locked\",\n \"message\": \"this resource has been locked\"\n}\n```\n\n### `Boom.preconditionRequired([message], [data])`\n\nReturns a 428 Precondition Required error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.preconditionRequired('you must supply an If-Match header');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 428,\n \"error\": \"Precondition Required\",\n \"message\": \"you must supply an If-Match header\"\n}\n```\n\n### `Boom.tooManyRequests([message], [data])`\n\nReturns a 429 Too Many Requests error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.tooManyRequests('you have exceeded your request limit');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 429,\n \"error\": \"Too Many Requests\",\n \"message\": \"you have exceeded your request limit\"\n}\n```\n\n### `Boom.illegal([message], [data])`\n\nReturns a 451 Unavailable For Legal Reasons error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.illegal('you are not permitted to view this resource for legal reasons');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 451,\n \"error\": \"Unavailable For Legal Reasons\",\n \"message\": \"you are not permitted to view this resource for legal reasons\"\n}\n```\n\n## HTTP 5xx Errors\n\nAll 500 errors hide your message from the end user. Your message is recorded in the server log.\n\n### `Boom.badImplementation([message], [data])` - (*alias: `internal`*)\n\nReturns a 500 Internal Server Error error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.badImplementation('terrible implementation');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 500,\n \"error\": \"Internal Server Error\",\n \"message\": \"An internal server error occurred\"\n}\n```\n\n### `Boom.notImplemented([message], [data])`\n\nReturns a 501 Not Implemented error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.notImplemented('method not implemented');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 501,\n \"error\": \"Not Implemented\",\n \"message\": \"method not implemented\"\n}\n```\n\n### `Boom.badGateway([message], [data])`\n\nReturns a 502 Bad Gateway error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.badGateway('that is a bad gateway');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 502,\n \"error\": \"Bad Gateway\",\n \"message\": \"that is a bad gateway\"\n}\n```\n\n### `Boom.serverUnavailable([message], [data])`\n\nReturns a 503 Service Unavailable error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.serverUnavailable('unavailable');\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 503,\n \"error\": \"Service Unavailable\",\n \"message\": \"unavailable\"\n}\n```\n\n### `Boom.gatewayTimeout([message], [data])`\n\nReturns a 504 Gateway Time-out error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.gatewayTimeout();\n```\n\nGenerates the following response payload:\n\n```json\n{\n \"statusCode\": 504,\n \"error\": \"Gateway Time-out\"\n}\n```\n\n## F.A.Q.\n\n**Q** How do I include extra information in my responses? `output.payload` is missing `data`, what gives?\n\n**A** There is a reason the values passed back in the response payloads are pretty locked down. It's mostly for security and to not leak any important information back to the client. This means you will need to put in a little more effort to include extra information about your custom error. Check out the [\"Error transformation\"](https://github.com/hapijs/hapi/blob/master/API.md#error-transformation) section in the hapi documentation.\n\n---\n", "readmeFilename": "README.md", "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" }