{"name":"egg-onerror","version":"2.1.0","description":"error handler for egg","eggPlugin":{"name":"onerror","optionalDependencies":["jsonp"]},"files":["config","lib","app.js","agent.js"],"repository":{"type":"git","url":"git+https://github.com/eggjs/egg-onerror.git"},"keywords":["egg","egg-plugin","onerror"],"dependencies":{"cookie":"^0.3.1","koa-onerror":"^4.0.0","mustache":"^2.3.0","stack-trace":"^0.0.10"},"devDependencies":{"autod":"^3.0.0","egg":"next","egg-bin":"^4.3.5","egg-ci":"^1.8.0","egg-mock":"^3.13.1","eslint":"^4.11.0","eslint-config-egg":"^5.1.1","pedding":"^1.1.0","rimraf":"^2.6.2"},"engines":{"node":">=8.0.0"},"scripts":{"test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","lint":"eslint .","ci":"npm run lint && npm run cov","autod":"autod"},"ci":{"version":"8, 9"},"author":{"name":"dead_horse"},"gitHead":"4824a0420fe6eb569c400d8306bdb208b83c4d20","bugs":{"url":"https://github.com/eggjs/egg-onerror/issues"},"homepage":"https://github.com/eggjs/egg-onerror#readme","_id":"egg-onerror@2.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"dist":{"integrity":"sha512-ujsqFfcXjWZPiYbZAz4bfaCribV6V3DkltYUvwiTV7Qi4g16w6+L9eMHk/eHq8+3Frlis8WT6CcJL0zKUDmLUQ==","shasum":"e05dc08e39aec16518b64053b8bc874110aba9f7","tarball":"http://registry-npm.ywwl.com/egg-onerror/download/egg-onerror-2.1.0.tgz","fileCount":10,"unpackedSize":53516,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbH6mVCRA9TVsSAnZWagAABv4P/jOkdDyce+1TSz4THbHo\n7hfRw+iC54Wj92aqc87QW81YvjxMsvAkx8YIJL0vHlkVym+SUoQ5xfBVtl4b\nIXRZ1yR++h6d/uFE9PjTHw5Y5LadbaKSZumqR2SUVhe7NbS46oNdMMHdwZdn\nA8QluuQAo0K+z0E4ZVnDLd5DQZNsSCdEd9VCGuifA7gfnNY22XmGh22jHw7T\nySgeLOuGOArf6n+Vx9gFQCeRshgOszJMXXudKOTfrjo/LL2ILSahzvzbYRnQ\nK1aTbq8tBLcii3NVEVXUBmPV+Trzb7qLutofqqSjOSpG+od8sMtt+KLM+xRJ\nsRt6lgJFp+1Qp8ORZFtz+diQsCXtAyzwLPT/UqiW1rVRBfQUqcifa6rOmCrZ\nnALWzSOj81zJ+ZAmEExW8zIexljCUdhytLfcXasRCvt9FpgIjSSu61ouVX3x\nddE9QUadZRtPXOruYMWz4J6rVCPLeb8WNVZXwIH0Nl4uq4aXQFKvr+96MlxI\nqzp0fC3+YJ2mwrQn4rF+JFUqs0h98s16kDOL23yLfy12iC/fTJmFlTgC/XEu\n8bV/WYYNHtaXK7hTptdX4emtwclOqDIMeBuo+l55voB+KHSRTkZh42rR/hpe\nv7uxNqGNtn0/KdHFjRbZ2EPzFZ83LC1GAWV4YSIEc5FIWgBC+Ezu6DbU8nyI\nq5w0\r\n=93tY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGhoFwJJWTSrUgniMT0RTpDDlMMDRoKRq9QsVtpZN8X+AiEAlG9SA+cqQeipmJGtJurkcDvIMYyony1t6+hVXGj3JQ4="}],"size":16248,"noattachment":false,"key":"/egg-onerror/-/egg-onerror-2.1.0.tgz"},"maintainers":[{"name":"atian25","email":"atian25@qq.com"},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"eggjs","email":"fengmk2+eggjs@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-onerror_2.1.0_1528801685042_0.948180529361079"},"_hasShrinkwrap":false,"readme":"# egg-onerror\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/eggjs/egg-onerror/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-onerror/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-onerror.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-onerror\n[codecov-image]: https://codecov.io/github/eggjs/egg-onerror/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/eggjs/egg-onerror?branch=master\n[snyk-image]: https://snyk.io/test/npm/egg-onerror/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-onerror\n[download-image]: https://img.shields.io/npm/dm/egg-onerror.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-onerror\n\nDefault error handling plugin for egg.\n\n## Install\n\n```bash\n$ npm i egg-onerror\n```\n\n## Usage\n\n`egg-onerror` is on by default in egg. But you still can configure its properties to fits your scenarios.\n\n- `errorPageUrl: String or Function` - If user request html pages in production environment and unexpected error happened, it will redirect user to `errorPageUrl`.\n- `accepts: Function` - detect user's request accpet `json` or `html`.\n- `all: Function` - customize error handler, if `all` present, negotiation will be ignored.\n- `html: Function` - customize html error handler.\n- `text: Function` - customize text error handler.\n- `json: Function` - customize json error handler.\n- `jsonp: Function` - customize jsonp error handler.\n\n```js\n// config.default.js\n// errorPageUrl support funtion\nexports.onerror = {\n  errorPageUrl: (err, ctx) => ctx.errorPageUrl || '/500',\n};\n\n// an accept detect function that mark all request with `x-requested-with=XMLHttpRequest` header accepts json.\nfunction accepts(ctx) {\n  if (ctx.get('x-requested-with') === 'XMLHttpRequest') return 'json';\n  return 'html';\n}\n```\n\n## Questions & Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](https://github.com/eggjs/egg-onerror/blob/master/LICENSE)\n","publish_time":1528801685091,"_cnpm_publish_time":1528801685091,"dist-tags":{"latest":"2.4.0","release-2.x":"2.4.0"}}