{ "name": "http-errors", "description": "Create HTTP error objects", "version": "1.2.0", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", "url": "http://jongleberry.com" }, "license": "MIT", "repository": { "type": "git", "url": "git://github.com/jshttp/http-errors" }, "dependencies": { "statuses": "~1.0.4" }, "devDependencies": { "istanbul": "0", "mocha": "1" }, "scripts": { "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", "LICENSE" ], "readme": "\n# http-errors\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Dependency Status][david-image]][david-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\nCreate HTTP errors for Express, Koa, Connect, etc. with ease.\n\n## Example\n\n```js\nvar createError = require('http-errors');\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- `message`\n- `status` and `statusCode` - the status code of the error, defaulting to `500`\n\n### createError([status], [message], [properties])\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### new createError\\[code || name\\](\\[msg]\\))\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[npm-image]: https://img.shields.io/npm/v/http-errors.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/http-errors\n[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg?style=flat-square\n[travis-url]: https://travis-ci.org/jshttp/http-errors\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/jshttp/http-errors?branch=master\n[david-image]: http://img.shields.io/david/jshttp/http-errors.svg?style=flat-square\n[david-url]: https://david-dm.org/jshttp/http-errors\n[license-image]: http://img.shields.io/npm/l/http-errors.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: http://img.shields.io/npm/dm/http-errors.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/http-errors\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/jshttp/http-errors/issues" }, "homepage": "https://github.com/jshttp/http-errors", "_id": "http-errors@1.2.0", "_shasum": "936739e42c3e9b778d84b30bce32802fd5eb9c75", "_from": "http-errors@~1.2.0", "_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.2.0.tgz" }