{"name":"http-errors","description":"Create HTTP error objects","version":"1.7.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Alan Plum","email":"me@pluma.io"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/jshttp/http-errors.git"},"dependencies":{"depd":"~1.1.2","inherits":"2.0.3","setprototypeof":"1.1.0","statuses":">= 1.5.0 < 2","toidentifier":"1.0.0"},"devDependencies":{"eslint":"4.19.1","eslint-config-standard":"11.0.0","eslint-plugin-import":"2.13.0","eslint-plugin-markdown":"1.0.0-beta.6","eslint-plugin-node":"6.0.1","eslint-plugin-promise":"3.8.0","eslint-plugin-standard":"3.1.0","istanbul":"0.4.5","mocha":"1.21.5"},"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"},"keywords":["http","error"],"files":["index.js","HISTORY.md","LICENSE","README.md"],"gitHead":"e2bdd75b81b2b7b168f066c61d1f0083d84daae2","bugs":{"url":"https://github.com/jshttp/http-errors/issues"},"homepage":"https://github.com/jshttp/http-errors#readme","_id":"http-errors@1.7.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"dist":{"integrity":"sha512-hz3BtSHB7Z6dNWzYc+gUbWqG4dIpJedwwOhe1cvGUq5tGmcTTIRkPiAbyh/JlZx+ksSJyGJlgcHo5jGahiXnKw==","shasum":"b6d36492a201c7888bdcb5dd0471140423c4ad2a","tarball":"http://registry-npm.ywwl.com/http-errors/download/http-errors-1.7.0.tgz","fileCount":5,"unpackedSize":16955,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX0gUCRA9TVsSAnZWagAAEfYP/i1jvg9LMStbGgVRvHX/\nKCmUlRm/7/qHjTWab9+78OKfSc58omNZcLThSY9qjTn6Ac9eVxUMwwcoTfnG\nPMNrz7utKjn8WAyaJDeFKHKdFwOW9CJjRhnp5cSgCgchl5a+KER0XsPyA2FH\n2mzoiWImToSE+2yjFgRuSYWiAs36qJHuDz9w/w4ina1AoGK16s1xHG2dfPm1\nm9vVRRMEY4R0wXaVboNvLa0CIMmgNRvjA2NOJhYg5/5zgTnDGyf7LdfSamQn\naU4prOmZw0e4xG/AVL+A81dkVURmpmwXckIPfg3BQXUWLQdcpJ4K++AjLiTU\nDljWxRsbExveGYSWiJ9D/LgXI6CGDmpnqyWUVH2eywFYBi40TxAnhDoKwZoe\nTmLFTQpFDXN+y/YA1YnWJxMy2/o6Cx3veGsPEKUVM+DPGccADg+KhDoK4u3Z\nWvh6+zQCn+g93SMhmWabJiXqdPQzgvyvF1gmqhf+EYtV15ODwBWa1dVc40hz\nSaRH62lu82aIT+zg4NADTCFggjzuhvMsyoHSEiml9J+dZs9gap1figWLtw68\nFxcc8PnE6o5ScPlu4NjmocvmbtUOn3ruX8PWU2d+cqyYmoOgDHxf58gOy8i5\ncu32x/mGqTL8MgKN5zbb107hV9Cs/yewBcq+V1FmyZbtx01k4ry6lQ9Mjk6/\nnyJ6\r\n=e9ve\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBitCM8MWDRxOZSSykR8EhyXWoYy4TzwimgGVSNwsdHcAiEA7x6xwmyTozPj/4fjRXFzXukzowd/CxnGZCoQmHD7SFE="}],"size":5863,"noattachment":false,"key":"/http-errors/-/http-errors-1.7.0.tgz"},"maintainers":[{"email":"doug@somethingdoug.com","name":"dougwilson"},{"email":"npm@egeste.net","name":"egeste"},{"email":"jonathanrichardong@gmail.com","name":"jongleberry"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-errors_1.7.0_1532971028236_0.4059577779248733"},"_hasShrinkwrap":false,"readme":"# http-errors\n\n[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][node-url]\n[![Node.js Version][node-image]][node-url]\n[![Build Status][ci-image]][ci-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nCreate HTTP errors for Express, Koa, Connect, etc. with ease.\n\n## Install\n\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```console\n$ npm install http-errors\n```\n\n## Example\n\n```js\nvar createError = require('http-errors')\nvar express = require('express')\nvar app = express()\n\napp.use(function (req, res, next) {\n  if (!req.user) return next(createError(401, 'Please login to view this page.'))\n  next()\n})\n```\n\n## API\n\nThis is the current API, currently extracted from Koa and subject to change.\n\n### Error Properties\n\n- `expose` - can be used to signal if `message` should be sent to the client,\n  defaulting to `false` when `status` >= 500\n- `headers` - can be an object of header names to values to be sent to the\n  client, defaulting to `undefined`. When defined, the key names should all\n  be lower-cased\n- `message` - the traditional error message, which should be kept short and all\n  single line\n- `status` - the status code of the error, mirroring `statusCode` for general\n  compatibility\n- `statusCode` - the status code of the error, defaulting to `500`\n\n### createError([status], [message], [properties])\n\nCreate a new error object with the given message `msg`.\nThe error object inherits from `createError.HttpError`.\n\n```js\nvar err = createError(404, 'This video does not exist!')\n```\n\n- `status: 500` - the status code as a number\n- `message` - the message of the error, defaulting to node's text for that status code.\n- `properties` - custom properties to attach to the object\n\n### createError([status], [error], [properties])\n\nExtend the given `error` object with `createError.HttpError`\nproperties. This will not alter the inheritance of the given\n`error` object, and the modified `error` object is the\nreturn value.\n\n<!-- eslint-disable no-redeclare -->\n\n```js\nfs.readFile('foo.txt', function (err, buf) {\n  if (err) {\n    if (err.code === 'ENOENT') {\n      var httpError = createError(404, err, { expose: false })\n    } else {\n      var httpError = createError(500, err)\n    }\n  }\n})\n```\n\n- `status` - the status code as a number\n- `error` - the error object to extend\n- `properties` - custom properties to attach to the object\n\n### createError.isHttpError(val)\n\nDetermine if the provided `val` is an `HttpError`. This will return `true`\nif the error inherits from the `HttpError` constructor of this module or\nmatches the \"duck type\" for an error this module creates. All outputs from\nthe `createError` factory will return `true` for this function, including\nif an non-`HttpError` was passed into the factory.\n\n### new createError\\[code || name\\](\\[msg]\\))\n\nCreate a new error object with the given message `msg`.\nThe error object inherits from `createError.HttpError`.\n\n```js\nvar err = new createError.NotFound()\n```\n\n- `code` - the status code as a number\n- `name` - the name of the error as a \"bumpy case\", i.e. `NotFound` or `InternalServerError`.\n\n#### List of all constructors\n\n|Status Code|Constructor Name             |\n|-----------|-----------------------------|\n|400        |BadRequest                   |\n|401        |Unauthorized                 |\n|402        |PaymentRequired              |\n|403        |Forbidden                    |\n|404        |NotFound                     |\n|405        |MethodNotAllowed             |\n|406        |NotAcceptable                |\n|407        |ProxyAuthenticationRequired  |\n|408        |RequestTimeout               |\n|409        |Conflict                     |\n|410        |Gone                         |\n|411        |LengthRequired               |\n|412        |PreconditionFailed           |\n|413        |PayloadTooLarge              |\n|414        |URITooLong                   |\n|415        |UnsupportedMediaType         |\n|416        |RangeNotSatisfiable          |\n|417        |ExpectationFailed            |\n|418        |ImATeapot                    |\n|421        |MisdirectedRequest           |\n|422        |UnprocessableEntity          |\n|423        |Locked                       |\n|424        |FailedDependency             |\n|425        |TooEarly                     |\n|426        |UpgradeRequired              |\n|428        |PreconditionRequired         |\n|429        |TooManyRequests              |\n|431        |RequestHeaderFieldsTooLarge  |\n|451        |UnavailableForLegalReasons   |\n|500        |InternalServerError          |\n|501        |NotImplemented               |\n|502        |BadGateway                   |\n|503        |ServiceUnavailable           |\n|504        |GatewayTimeout               |\n|505        |HTTPVersionNotSupported      |\n|506        |VariantAlsoNegotiates        |\n|507        |InsufficientStorage          |\n|508        |LoopDetected                 |\n|509        |BandwidthLimitExceeded       |\n|510        |NotExtended                  |\n|511        |NetworkAuthenticationRequired|\n\n## License\n\n[MIT](LICENSE)\n\n[ci-image]: https://badgen.net/github/checks/jshttp/http-errors/master?label=ci\n[ci-url]: https://github.com/jshttp/http-errors/actions?query=workflow%3Aci\n[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/http-errors/master\n[coveralls-url]: https://coveralls.io/r/jshttp/http-errors?branch=master\n[node-image]: https://badgen.net/npm/node/http-errors\n[node-url]: https://nodejs.org/en/download\n[npm-downloads-image]: https://badgen.net/npm/dm/http-errors\n[npm-url]: https://npmjs.org/package/http-errors\n[npm-version-image]: https://badgen.net/npm/v/http-errors\n[travis-image]: https://badgen.net/travis/jshttp/http-errors/master\n[travis-url]: https://travis-ci.org/jshttp/http-errors\n","publish_time":1532971028342,"_cnpm_publish_time":1532971028342,"dist-tags":{"latest":"2.0.1"}}