This commit is contained in:
robin
2022-04-12 00:51:40 +08:00
parent c2f8473fb5
commit 344562baf4
18 changed files with 940 additions and 39 deletions
+12
View File
@@ -0,0 +1,12 @@
'use strict';
const error = require('koa-json-error')
// 错误处理
module.exports = error((err) => {
return {
status : err.status,
message : err.message,
code : err.code,
res : false,
// postFormat: (e, obj) => process.env.NODE_ENV === 'production' ? _.omit(obj, 'stack') : obj
}
})
-1
View File
@@ -5,7 +5,6 @@ module.exports = async (ctx, next, app) => {
// const timetaken = `${ctx.request.method}${ctx.request.url} 响应时间`
// console.time(timetaken)
// app.logger.debug("123")
throw new app.err.HttpException
await next()
// console.timeEnd(timetaken)
}