{"_id":"@eggjs/onerror@4.1.0","bugs":{"url":"https://github.com/eggjs/egg/issues"},"dist":{"shasum":"5aa7dfebd59ef73275262a26a0d6ede1d2c1bb65","tarball":"http://registry-npm.ywwl.com/@eggjs/onerror/download/@eggjs/onerror-4.1.0.tgz","fileCount":21,"integrity":"sha512-qEwE9THKjnQkUxN432w1lycnC2bMRhANP1QwFegPgQL9jVL1633jTAstWrXda6UmR+SaJFyNtPG03AdZlLESFA==","signatures":[{"sig":"MEYCIQDED11n4ueix07+8zYRc30CKBLtIMbqozn4XgMFQYnIKAIhAIRT+HYjLuEFE39U11db8VPySIBMIkql7mAoncd4ywqa","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC/D/waZCCmR8cp2kyb5gIhfG44LQGsPrWUTmD7r6MfuQIgXXSVVwMWdLLPhmpg8jkygNyjEMNqGaoPNxfxAf5GWzY="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eggjs%2fonerror@4.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":125029,"size":30929,"noattachment":false,"key":"/@eggjs/onerror/-/@eggjs/onerror-4.1.0.tgz"},"name":"@eggjs/onerror","type":"module","types":"./dist/index.d.ts","author":{"name":"dead_horse"},"engines":{"node":">=22.18.0"},"exports":{".":"./dist/index.js","./app":"./dist/app.js","./agent":"./dist/agent.js","./types":"./dist/types.js","./lib/utils":"./dist/lib/utils.js","./lib/onerror":"./dist/lib/onerror.js","./package.json":"./package.json","./lib/error_view":"./dist/lib/error_view.js","./lib/onerror_page":"./dist/lib/onerror_page.js","./config/config.default":"./dist/config/config.default.js"},"gitHead":"e9cc326c1a1b6f2d953162747e37dd3a7a7088dc","license":"MIT","scripts":{"typecheck":"tsc --noEmit"},"version":"4.1.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"79f830b6-efcc-4a28-a23f-d243a62fb6ea"}},"homepage":"https://github.com/eggjs/egg/tree/next/plugins/onerror","keywords":["egg","egg-plugin","onerror"],"repository":{"url":"git+https://github.com/eggjs/egg.git","type":"git","directory":"plugins/onerror"},"_npmVersion":"11.19.0","description":"error handler for egg","directories":{},"maintainers":[{"name":"gxkl","email":"gxkl203@gmail.com"},{"name":"eggjs-admin","email":"fengmk2+eggjs@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"atian25","email":"atian25@qq.com"},{"name":"hyj1991","email":"yeekwanvong@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"coolme200","email":"2001-wms@163.com"},{"name":"akitasummer","email":"644171127@qq.com"},{"name":"elrrrrrrr","email":"elrrrrrrr@gmail.com"},{"name":"niania","email":"ljracm@gmail.com"}],"_nodeVersion":"24.21.0","dependencies":{"cookie":"^1.0.2","mustache":"^4.2.0","stack-trace":"^0.0.10"},"publishConfig":{"access":"public","exports":{".":"./dist/index.js","./app":"./dist/app.js","./agent":"./dist/agent.js","./types":"./dist/types.js","./lib/utils":"./dist/lib/utils.js","./lib/onerror":"./dist/lib/onerror.js","./package.json":"./package.json","./lib/error_view":"./dist/lib/error_view.js","./lib/onerror_page":"./dist/lib/onerror_page.js","./config/config.default":"./dist/config/config.default.js"}},"_hasShrinkwrap":false,"devDependencies":{"egg":"4.2.0","typescript":"^7.0.2","@eggjs/mock":"7.1.0","@types/mustache":"^4.2.5","@types/stack-trace":"^0.0.33"},"peerDependencies":{"egg":"4.2.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/onerror_4.1.0_1791361203775_0.6042874131521794"},"readme":"# @eggjs/onerror\n\n[![NPM version][npm-image]][npm-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n[![Node.js Version](https://img.shields.io/node/v/@eggjs/onerror.svg?style=flat)](https://nodejs.org/en/download/)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/eggjs/onerror)\n\n[npm-image]: https://img.shields.io/npm/v/@eggjs/onerror.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@eggjs/onerror\n[snyk-image]: https://snyk.io/test/npm/@eggjs/onerror/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/@eggjs/onerror\n[download-image]: https://img.shields.io/npm/dm/@eggjs/onerror.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@eggjs/onerror\n\nDefault error handling plugin for egg.\n\n## Usage\n\n`onerror` plugin is enabled 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 accept `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- `js: Function` - customize JSONP error handler.\n\n```ts\n// config/config.default.ts\nimport { defineConfig } from 'egg';\n\nexport default defineConfig({\n  onerror: {\n    // errorPageUrl support function\n    errorPageUrl: (err, ctx) => ctx.errorPageUrl || '/500',\n  },\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](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=eggjs/egg)](https://github.com/eggjs/egg/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","publish_time":1791361203861,"_cnpm_publish_time":1791361203861,"dist-tags":{"beta":"4.0.2-beta.27","latest":"4.1.0","rc":"4.0.2-rc.1"}}