perf(WAI): 日志

dev/supplier-email-drawer
Lei OT 9 months ago
parent 7363ebcb9a
commit 37e952c7f0

@ -1,3 +1,6 @@
'use strict';
const logger = require('../../utils/logger.util');
module.exports = async (ctx, next) => {
try {
const data = await next();
@ -10,10 +13,10 @@ module.exports = async (ctx, next) => {
ctx.status = 200; // Set status to 200 if not already set
}
} catch (err) {
console.log('Error handler:', err);
logger.error('Error handler:', err);
// ctx.status = 200; // err.status || 500;
ctx.body = {
errcode: 1,
errcode: err.status || 500,
errmsg: err.message || 'Internal server error',
statuscode: err.status,
result: null,

Loading…
Cancel
Save