package.json 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. {
  2. "_args": [
  3. [
  4. {
  5. "raw": "boom@2.x.x",
  6. "scope": null,
  7. "escapedName": "boom",
  8. "name": "boom",
  9. "rawSpec": "2.x.x",
  10. "spec": ">=2.0.0 <3.0.0",
  11. "type": "range"
  12. },
  13. "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/hawk"
  14. ]
  15. ],
  16. "_from": "boom@>=2.0.0 <3.0.0",
  17. "_id": "boom@2.10.1",
  18. "_inCache": true,
  19. "_location": "/boom",
  20. "_nodeVersion": "0.10.40",
  21. "_npmUser": {
  22. "name": "arb",
  23. "email": "arbretz@gmail.com"
  24. },
  25. "_npmVersion": "2.11.1",
  26. "_phantomChildren": {},
  27. "_requested": {
  28. "raw": "boom@2.x.x",
  29. "scope": null,
  30. "escapedName": "boom",
  31. "name": "boom",
  32. "rawSpec": "2.x.x",
  33. "spec": ">=2.0.0 <3.0.0",
  34. "type": "range"
  35. },
  36. "_requiredBy": [
  37. "/cryptiles",
  38. "/hawk"
  39. ],
  40. "_resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
  41. "_shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
  42. "_shrinkwrap": null,
  43. "_spec": "boom@2.x.x",
  44. "_where": "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/hawk",
  45. "bugs": {
  46. "url": "https://github.com/hapijs/boom/issues"
  47. },
  48. "dependencies": {
  49. "hoek": "2.x.x"
  50. },
  51. "description": "HTTP-friendly error objects",
  52. "devDependencies": {
  53. "code": "1.x.x",
  54. "lab": "7.x.x"
  55. },
  56. "directories": {},
  57. "dist": {
  58. "shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
  59. "tarball": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz"
  60. },
  61. "engines": {
  62. "node": ">=0.10.40"
  63. },
  64. "gitHead": "ff1a662a86b39426cdd18f4441b112d307a34a6f",
  65. "homepage": "https://github.com/hapijs/boom#readme",
  66. "keywords": [
  67. "error",
  68. "http"
  69. ],
  70. "license": "BSD-3-Clause",
  71. "main": "lib/index.js",
  72. "maintainers": [
  73. {
  74. "name": "hueniverse",
  75. "email": "eran@hueniverse.com"
  76. },
  77. {
  78. "name": "wyatt",
  79. "email": "wpreul@gmail.com"
  80. },
  81. {
  82. "name": "arb",
  83. "email": "arbretz@gmail.com"
  84. }
  85. ],
  86. "name": "boom",
  87. "optionalDependencies": {},
  88. "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",
  89. "readmeFilename": "README.md",
  90. "repository": {
  91. "type": "git",
  92. "url": "git://github.com/hapijs/boom.git"
  93. },
  94. "scripts": {
  95. "test": "lab -a code -t 100 -L",
  96. "test-cov-html": "lab -a code -r html -o coverage.html -L"
  97. },
  98. "version": "2.10.1"
  99. }