{"_id":"@busyhe/ynn-plugin-exception","_rev":"1-1a1d28b6e57886c95e7ff46f520e5ed9","name":"@busyhe/ynn-plugin-exception","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@busyhe/ynn-plugin-exception","version":"0.0.1","description":"ynn异常处理通用插件","main":"src/index.js","scripts":{"test":"jest --forceExit","tw":"npm run test-watch","test-watch":"jest --watch","test-cov":"jest --coverage --runInBand --forceExit --detectOpenHandles","lint":"eslint lib --cache --ignore-path .eslintignore","precommit-msg":"echo 'Pre-commit checks...' && exit 0"},"repository":{"type":"git","url":"git+https://github.com/busyhe-ynn-plugins/plugin-exception.git"},"keywords":["exception","ynn","plugin","common"],"author":{"name":"LvChengbin","email":"lvchengbin59@gmail.com"},"jest":{"testMatch":["**/test/**/*.spec.js"],"coverageReporters":["text-summary","text","lcov"],"collectCoverageFrom":["lib/**/*.js"],"testEnvironment":"node"},"devDependencies":{"eslint":"^6.8.0","jest":"^25.4.0","pre-commit":"^1.2.2","ynn":"0.1.1"},"dependencies":{"@lvchengbin/is":"0.0.27"},"gitHead":"3c2559a7530d446c5dffdca330bc633d19046b06","bugs":{"url":"https://github.com/busyhe-ynn-plugins/plugin-exception/issues"},"homepage":"https://github.com/busyhe-ynn-plugins/plugin-exception#readme","_id":"@busyhe/ynn-plugin-exception@0.0.1","_nodeVersion":"12.12.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-b+g0hTiMYu9ytTqBnQjxLiMJzOocnuUgaTHeZlqJNdrnTOsiS8cWKbcvU0dGMmqFg5P4x7pz0UYhkfbxLnBYrA==","shasum":"ad1fb8d1408fe739258fb99a13918f3c29e6fd9d","tarball":"https://registry.npmjs.org/@busyhe/ynn-plugin-exception/-/ynn-plugin-exception-0.0.1.tgz","fileCount":9,"unpackedSize":7610,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeplV8CRA9TVsSAnZWagAAVToP/RaOhPWW9+g9usQjw7h5\nqZm0tWDqLS7ocFUSgVSN6hxeWLmRZI/R1iQuLRHDj3zwxNozbFt9nnZL+r6B\nLAlqxxsaVej/eiuKp0XKnWXvdx/QoOpq0sAzUIJ+7ZIILmmg8iO0EVJm2lpJ\ng5RqES0lig7940S7SF8sljMeCXo1l5+T+/kvpwrVsFeMQWmZqVnYuDGA9Dbl\nWE+H9rkZdOWnmQ3V7WpV9axmTS78/q9HzVzSLbzEfjSUHRT1Xox+zqv1UTr+\n4VGWB7ePr9d9+zG4ODgx5opfDlYqmK8+Z3RSBuaLbbMItY6XMSvzolZw3Mu1\np4ucih1zi0fYHc3HdI5c7fHGAe+gWJRng+mWfn9rIxNZg0sklcYBLPM7PZx+\niUqkxQhtb+pba6vAB/Xh4P82/CqyJrXZkYf1h1us7ev/37RdR/Nx4XQLNCys\njeZyjv6QbaWda73zrV92u/5/wcjYkDjbOY/Lq4lHZo7VwUDb18uOLW7NEmnF\n5SbZELytRAuwJRLtnlMcQRuZonp8/fdpLfQBrWb5eF0UqvvMhxU+KTnUHPCh\nHxGwZBHw75RKfFNaLb3ahABqafsdWMBSJbvSdEyM9kGBj6ofyuw2sDLC0F6a\nLX1e3b29pRPk98/kNsBgzEuW1L3VyDvpACxGvVU+EjcDLxfGfGy2tj7X3C64\nf315\r\n=NtLD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFuozxMzY+832UUtsoX/9eD5eTZmf+FiOgmnEBMtYpS+AiEA5WvUbe9aXgnQzgckFISDaQv/mP1kgz1Qu4LTSNlrbZk="}]},"maintainers":[{"name":"busyhe","email":"525118368@qq.com"}],"_npmUser":{"name":"busyhe","email":"525118368@qq.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ynn-plugin-exception_0.0.1_1587959164371_0.22917157823132084"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-27T03:46:04.341Z","0.0.1":"2020-04-27T03:46:04.495Z","modified":"2022-04-04T21:09:59.531Z"},"maintainers":[{"name":"busyhe","email":"525118368@qq.com"}],"description":"ynn异常处理通用插件","homepage":"https://github.com/busyhe-ynn-plugins/plugin-exception#readme","keywords":["exception","ynn","plugin","common"],"repository":{"type":"git","url":"git+https://github.com/busyhe-ynn-plugins/plugin-exception.git"},"author":{"name":"LvChengbin","email":"lvchengbin59@gmail.com"},"bugs":{"url":"https://github.com/busyhe-ynn-plugins/plugin-exception/issues"},"readme":"# @busyhe/ynn-plugin-exception\n\n前端服务异常处理通用模块\n\n## 各模块自定义Errors规则\n\n各个模块自定义Errors的code，不可以使用1000之前的数字，格式如下：\n\n```js\n{\n    CUSTOM_ERROR : {\n        code : 1000,\n        message : 'custom error message'\n    }\n}\n```\n\n## Installation\n\n```sh\n$ npm install --save @busyhe/ynn-plugin-exception\n```\n\n## Usage\n\n```js\nconst Ynn = require( 'ynn' );\nconst app = new Ynn( {\n    root : __dirname,\n    debugging : Ynn.DEBUGGING_DANGER,\n    logging : false,\n    plugins : {\n        Exception : {\n            path : '@busyhe/ynn-plugin-exception',\n            options : {\n                // 也可以通过 config/errors.js 进行配置\n                errors : {\n                    CUSTOM_ERROR : {\n                        code : 1000,\n                        message : 'custom error message'\n                    }\n                }\n            }\n        }\n    }\n} );\n\napp.use( () => {\n    throw new app.Exception( 'CUSTOM_ERROR' );\n} );\n```\n\n上面代码在接收到请求后，将返回：\n\n```js\n{\n    status : 1,\n    errno : 1000,\n    message : 'custom error message'\n}\n```\n","readmeFilename":"README.md"}