后端搭建起来
This commit is contained in:
@@ -10,7 +10,7 @@ module.exports = () => async function errorHandler(ctx, next) {
|
||||
? 'Internal Server Error'
|
||||
: err.message;
|
||||
// 从 error 对象上读出各个属性,设置到响应中
|
||||
ctx.body = {error};
|
||||
ctx.body = {code: 1, error};
|
||||
if (status === 422) {
|
||||
ctx.body.detail = err.errors;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user