...
|
...
|
@@ -7,10 +7,15 @@ const logger = global.yoho.logger; |
|
|
|
|
|
const serverError = (err, req, res, next) => { // eslint-disable-line
|
|
|
logger.error(err);
|
|
|
let code = 500, msg = '服务器错误!';
|
|
|
|
|
|
return res.status(500).json({
|
|
|
code: 500,
|
|
|
message: '服务器错误!'
|
|
|
if (err.code && typeof err.code === 'number' && err.code !== 500 && err.message && !err.message.match(/_ERROR/gi)[0]) {
|
|
|
code = err.code;
|
|
|
msg = err.message;
|
|
|
}
|
|
|
return res.status(code).json({
|
|
|
code: code,
|
|
|
message: msg
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|