mirror of
https://github.com/linuxserver/core.git
synced 2026-02-20 05:07:19 +08:00
43 lines
3.0 KiB
JSON
43 lines
3.0 KiB
JSON
{
|
|
"name": "http-error",
|
|
"description": "Expose HTTP error codes as Error objects",
|
|
"version": "0.0.6",
|
|
"author": {
|
|
"name": "Cloud9 B.V.",
|
|
"email": "info@c9.io"
|
|
},
|
|
"contributors": [
|
|
{
|
|
"name": "Fabian Jakobs",
|
|
"email": "fabian@c9.io"
|
|
}
|
|
],
|
|
"main": "error.js",
|
|
"scripts": {
|
|
"test": "./node_modules/mocha/bin/mocha error_test.js"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+ssh://git@github.com/c9/node-http-error.git"
|
|
},
|
|
"licenses": [
|
|
{
|
|
"type": "MIT",
|
|
"url": "http://github.com/c9/node-http-error/raw/master/LICENSE"
|
|
}
|
|
],
|
|
"devDependencies": {
|
|
"mocha": "^2.3.4"
|
|
},
|
|
"readme": "## http-error\n\nExposes HTTP error codes as Error constructors.\n\n### Install\n\n npm install http-error\n\n### Example\n\n\n```javascript\n\n var HttpError = require(\"http-error\");\n\n // in your app:\n app.get(\"/:project\", function(req, res, next){\n db.loadProject(req.params.project, function(err, project){\n if(err) return next(new HttpError.InternalServerError(\"Something went wrong\"));\n if(!project) return next(new HttpError.notFound(\"This project does not exist\"));\n \n res.json(project.toObject());\n });\n });\n \n // in your error handler:\n app.use(function(err, req, res, next){\n res.status(err.code).json({ error: err.message });\n });\n```\n\n### List of errors\n\nThis module implements the following error constructors:\n\n| Code | Function\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 | RequestEntityTooLarge\n| 414 | RequestURITooLong\n| 415 | UnsupportedMediaType\n| 416 | RequestedRangeNotSatisfiable\n| 417 | ExpectationFailed\n| 420 | EnhanceYourCalm\n| 422 | UnprocessableEntity\n| 423 | Locked\n| 424 | FailedDependency\n| 425 | UnorderedCollection\n| 426 | UpgradeRequired\n| 428 | PreconditionRequired\n| 429 | TooManyRequests\n| 431 | RequestHeaderFieldsTooLarge\n| 444 | NoResponse\n| 449 | RetryWith\n| 450 | BlockedByWindowsParentalControls\n| 499 | ClientClosedRequest\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",
|
|
"readmeFilename": "README.md",
|
|
"bugs": {
|
|
"url": "https://github.com/c9/node-http-error/issues"
|
|
},
|
|
"homepage": "https://github.com/c9/node-http-error#readme",
|
|
"_id": "http-error@0.0.6",
|
|
"_shasum": "bff309b0bdafe30d95fbb73ac2dd2bdd39bbc074",
|
|
"_resolved": "https://registry.npmjs.org/http-error/-/http-error-0.0.6.tgz",
|
|
"_from": "http-error@>=0.0.5 <0.1.0"
|
|
}
|