{"name":"@eggjs/onerror","version":"4.0.0-beta.26","keywords":["egg","egg-plugin","onerror"],"author":{"name":"dead_horse"},"_id":"@eggjs/onerror@4.0.0-beta.26","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":"akitasummer@outlook.com"}],"homepage":"https://github.com/eggjs/egg/tree/next/plugins/onerror","bugs":{"url":"https://github.com/eggjs/egg/issues"},"dist":{"shasum":"1095e13f169ecdfe1acfd885b810aa83286deef6","tarball":"http://registry-npm.ywwl.com/@eggjs/onerror/download/@eggjs/onerror-4.0.0-beta.26.tgz","fileCount":18,"integrity":"sha512-HpnP1AEyHWdIVqH2+mnTUbB9bixZgxnVdeRApRIZnjhiWJRDMpCa4lmZPbYYCsuHs6esyCWrSrwFbAwdi3+e7g==","signatures":[{"sig":"MEQCIH1AH8fRcMNwuMeGz4dZXT5FKa0oj7RPrvn1LvSpknKqAiA7SUKgSS1S7rBdlVlXcwrnG8CpSJQ7FTFtwBXYgN+9PQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eggjs%2fonerror@4.0.0-beta.26","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":89453,"size":22281,"noattachment":false,"key":"/@eggjs/onerror/-/@eggjs/onerror-4.0.0-beta.26.tgz"},"main":"./dist/index.js","type":"module","_from":"file:eggjs-onerror-4.0.0-beta.26.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":{"lint":"oxlint --type-aware","test":"vitest run","build":"tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json && cp src/lib/onerror_page.mustache.html dist/lib/onerror_page.mustache.html","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6226ee77-d009-4395-ac78-6aa1f66167ca"}},"_resolved":"/tmp/f56f71264cd5870a07b1c0f7c5a6203e/eggjs-onerror-4.0.0-beta.26.tgz","eggPlugin":{"name":"onerror","optionalDependencies":["jsonp"]},"_integrity":"sha512-HpnP1AEyHWdIVqH2+mnTUbB9bixZgxnVdeRApRIZnjhiWJRDMpCa4lmZPbYYCsuHs6esyCWrSrwFbAwdi3+e7g==","repository":{"url":"git://github.com/eggjs/egg.git","type":"git","directory":"plugins/onerror"},"_npmVersion":"11.6.1","description":"error handler for egg","directories":{},"_nodeVersion":"22.20.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":{"tsdown":"^0.15.4","vitest":"4.0.0-beta.16","typescript":"^5.9.3","@eggjs/mock":"7.0.0-beta.26","@types/mustache":"^4.2.5","@types/stack-trace":"^0.0.33"},"peerDependencies":{"egg":"4.1.0-beta.26"},"_npmOperationalInternal":{"tmp":"tmp/onerror_4.0.0-beta.26_1759686074943_0.9462418417274381","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":1759686075157,"_cnpm_publish_time":1759686075157,"dist-tags":{"beta":"4.0.2-beta.27","latest":"4.1.0","rc":"4.0.2-rc.1"}}