{"name":"egg-onerror","version":"2.1.1","description":"error handler for egg","eggPlugin":{"name":"onerror","optionalDependencies":["jsonp"]},"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":"14, 16"},"author":{"name":"dead_horse"},"gitHead":"0d2f3c020f5ea96102db314c7434379767cad890","bugs":{"url":"https://github.com/eggjs/egg-onerror/issues"},"homepage":"https://github.com/eggjs/egg-onerror#readme","_id":"egg-onerror@2.1.1","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-MJBJvnA0AAft1LQAtqNFGjtIT8SLMFCLRBnhdnG6bd2+h699CJUf8RpqHKpTpY1fUyr+yHTk0ScDtMpDeVn1Lw==","shasum":"cfc63fb51239ccb80b901c1a3c85beaea1c34f83","tarball":"http://registry-npm.ywwl.com/egg-onerror/download/egg-onerror-2.1.1.tgz","fileCount":9,"unpackedSize":50845,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE+hHXjWk+DJvpW1sFN7sHb+hM839dmO2x67rxhi2FNPAiAGUoOQ68UYXpvYmpFbm+2bQHiB3VVxawaa3Pd2O/DTjg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/gQjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpCSQ/+L6qWCXcZlDZfx+g8/9BddTaZJLCpmqtxCVJR/omTwlaNr+D0\r\nnZlBjwzPwFqu6uK7PR17oZAF6sqUWbzQPUDWCktB1t0OZIwBXKcx5d3z0dKc\r\nZOoTj6TsibR0YTZXVAJXWS0W25f8p9sQPhlTYg0aMa9o9+m/NTJqCMPm77rX\r\nW2EWQkysgjdJlLjt42g3DADEIsAOO2/9Fe1kvZRMS8jXGgnmVhy5a7Tx6OtO\r\nxV2r2/fnzg9uRZmnhfVkBENCOG4YfMcWjjNiRjVx9Q3gUFfyeAcfhhLAyEtR\r\npQCSMChKD3OVz84FvT4IuTfDG9k4FCplBVJQR/nYFd75OYxiz2tPt2jHb9X1\r\nhf3WD8n0Y0T3q2qHhpWvbBECNhp5g8sftSAR0+UyqxUuJFseB3rYls1NGDGW\r\nPTDgRS1QmLge7L9FuHZfRYs8IptPk8pV/EzRDdynhgFtcqSXtjZg8i1oXRXd\r\nk7y6zfWL44YhMobACG6B2t87Vax2DQzKATo099LVNWUrVXsuqC8Q/X5lCiRu\r\nrNQvzOJxHAbUXbe2+GVA8cUPBFzF4fZoxtxi0Og4+P3cRAx3QXGsJkrnHLrk\r\nXUwxhsJl9buvDBFDqfEMgFlpECEvCl6Ue8c9BXbk7gIKW9TvWQmnRgpqC46k\r\nmcDsVpX27dbqQQJtZ9SOdjIn280d5Aga1So=\r\n=O4Km\r\n-----END PGP SIGNATURE-----\r\n","size":15083,"noattachment":false,"key":"/egg-onerror/-/egg-onerror-2.1.1.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"atian25","email":"atian25@qq.com"},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"},{"name":"eggjs-admin","email":"fengmk2+eggjs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-onerror_2.1.1_1660814371117_0.6710665124610131"},"_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":1660814371294,"_cnpm_publish_time":1660814371294,"dist-tags":{"latest":"2.4.0","release-2.x":"2.4.0"}}