{"name":"@eggjs/onerror","version":"4.0.2-beta.0","keywords":["egg","egg-plugin","onerror"],"author":{"name":"dead_horse"},"license":"MIT","_id":"@eggjs/onerror@4.0.2-beta.0","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"}],"homepage":"https://github.com/eggjs/egg/tree/next/plugins/onerror","bugs":{"url":"https://github.com/eggjs/egg/issues"},"dist":{"shasum":"69d12e859516f77ff86cfd2ff25549b7cf813cc2","tarball":"http://registry-npm.ywwl.com/@eggjs/onerror/download/@eggjs/onerror-4.0.2-beta.0.tgz","fileCount":18,"integrity":"sha512-ZzkDO6WVP8YSPiOhwTnGv3HrX+sanr+rGSuH+GREwoFQE4JE4/G8Ia4yST6Vaf7PfgD/z1bncuAvLSl+QGtM1w==","signatures":[{"sig":"MEYCIQDZ7YJDqlGWGp5FxoGI00L/w5fm4vxPK3xq3BWGbwc+tQIhAI5Q9vmDYO60IUGeHIA+WO+myMo/uQQu4+dItYdmsQd3","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eggjs%2fonerror@4.0.2-beta.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":68499,"size":17730,"noattachment":false,"key":"/@eggjs/onerror/-/@eggjs/onerror-4.0.2-beta.0.tgz"},"main":"./dist/index.js","type":"module","_from":"file:eggjs-onerror-4.0.2-beta.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","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","./package.json":"./package.json","./lib/error_view":"./dist/lib/error_view.js","./config/config.default":"./dist/config/config.default.js"},"scripts":{"typecheck":"tsgo --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6226ee77-d009-4395-ac78-6aa1f66167ca"}},"_resolved":"/tmp/e5def8ef80e44e1f1af0a40b49e753ed/eggjs-onerror-4.0.2-beta.0.tgz","_integrity":"sha512-ZzkDO6WVP8YSPiOhwTnGv3HrX+sanr+rGSuH+GREwoFQE4JE4/G8Ia4yST6Vaf7PfgD/z1bncuAvLSl+QGtM1w==","repository":{"url":"git+https://github.com/eggjs/egg.git","type":"git","directory":"plugins/onerror"},"_npmVersion":"11.6.2","description":"error handler for egg","directories":{},"_nodeVersion":"24.13.0","dependencies":{"cookie":"^1.0.2","mustache":"^4.2.0","koa-onerror":"^5.0.1","stack-trace":"^0.0.10"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"egg":"4.1.2-beta.0","typescript":"^5.9.3","@eggjs/mock":"7.0.2-beta.0","@types/mustache":"^4.2.5","@types/stack-trace":"^0.0.33"},"peerDependencies":{"egg":"4.1.2-beta.0"},"_npmOperationalInternal":{"tmp":"tmp/onerror_4.0.2-beta.0_1772032685536_0.8201264895067342","host":"s3://npm-registry-packages-npm-production"},"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":1772032685694,"_cnpm_publish_time":1772032685694,"dist-tags":{"beta":"4.0.2-beta.27","latest":"4.1.0","rc":"4.0.2-rc.1"}}