egg-youch
v1.0.3
Published
a global error handler plugin for egg,base on youch
Downloads
1
Readme
egg-youch
Install
$ npm i egg-youch --save
Usage
// {app_root}/config/plugin.js
exports.youch = {
enable: true,
package: 'egg-youch',
};
Configuration
// {app_root}/config/config.default.js
exports.youch = {
env:'local',
type: 'html',
jsonError: {
err: 'errors'
},
htmlError: `<h1>errors</h1>`
};
see config/config.default.js for more detail.
Example
when config.env==="prod" the response body will be config.jsonError or config.htmlError to provent error messages show to users. when config.env='local' or else,the response body will contains error messages
Questions & Suggestions
Please open an issue here.