123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- {
- "_args": [
- [
- {
- "raw": "boom@2.x.x",
- "scope": null,
- "escapedName": "boom",
- "name": "boom",
- "rawSpec": "2.x.x",
- "spec": ">=2.0.0 <3.0.0",
- "type": "range"
- },
- "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/hawk"
- ]
- ],
- "_from": "boom@>=2.0.0 <3.0.0",
- "_id": "boom@2.10.1",
- "_inCache": true,
- "_location": "/boom",
- "_nodeVersion": "0.10.40",
- "_npmUser": {
- "name": "arb",
- "email": "arbretz@gmail.com"
- },
- "_npmVersion": "2.11.1",
- "_phantomChildren": {},
- "_requested": {
- "raw": "boom@2.x.x",
- "scope": null,
- "escapedName": "boom",
- "name": "boom",
- "rawSpec": "2.x.x",
- "spec": ">=2.0.0 <3.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/cryptiles",
- "/hawk"
- ],
- "_resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
- "_shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
- "_shrinkwrap": null,
- "_spec": "boom@2.x.x",
- "_where": "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/hawk",
- "bugs": {
- "url": "https://github.com/hapijs/boom/issues"
- },
- "dependencies": {
- "hoek": "2.x.x"
- },
- "description": "HTTP-friendly error objects",
- "devDependencies": {
- "code": "1.x.x",
- "lab": "7.x.x"
- },
- "directories": {},
- "dist": {
- "shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
- "tarball": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz"
- },
- "engines": {
- "node": ">=0.10.40"
- },
- "gitHead": "ff1a662a86b39426cdd18f4441b112d307a34a6f",
- "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.png)](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**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## Overview\n\n- Helper methods\n - [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message)\n - [`create(statusCode, [message], [data])`](#createstatuscode-message-data)\n- HTTP 4xx Errors\n - 400: [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data)\n - 401: [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes)\n - 403: [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data)\n - 404: [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data)\n - 405: [`Boom.methodNotAllowed([message], [data])`](#boommethodnotallowedmessage-data)\n - 406: [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data)\n - 407: [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data)\n - 408: [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data)\n - 409: [`Boom.conflict([message], [data])`](#boomconflictmessage-data)\n - 410: [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data)\n - 411: [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data)\n - 412: [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data)\n - 413: [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data)\n - 414: [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data)\n - 415: [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data)\n - 416: [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data)\n - 417: [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data)\n - 422: [`Boom.badData([message], [data])`](#boombaddatamessage-data)\n - 428: [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data)\n - 429: [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data)\n- HTTP 5xx Errors\n - 500: [`Boom.badImplementation([message], [data])`](#boombadimplementationmessage-data)\n - 501: [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data)\n - 502: [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data)\n - 503: [`Boom.serverTimeout([message], [data])`](#boomservertimeoutmessage-data)\n - 504: [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data)\n- [FAQ](#faq)\n\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 `schema` 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.\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('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.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])`\n\nReturns a 405 Method Not Allowed error where:\n- `message` - optional message.\n- `data` - optional additional error data.\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.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.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## 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])`\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.serverTimeout([message], [data])`\n\nReturns a 503 Service Unavailable error where:\n- `message` - optional message.\n- `data` - optional additional error data.\n\n```js\nBoom.serverTimeout('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###### How do I include extra information in my responses? `output.payload` is missing `data`, what gives?\n\nThere 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",
- "readmeFilename": "README.md",
- "repository": {
- "type": "git",
- "url": "git://github.com/hapijs/boom.git"
- },
- "scripts": {
- "test": "lab -a code -t 100 -L",
- "test-cov-html": "lab -a code -r html -o coverage.html -L"
- },
- "version": "2.10.1"
- }
|