'use strict'; module.exports = () => { return async function errorHandler(ctx, next) { try { await next(); } catch (err) { console.log(err); console.log(err.code); // const { message } = err; // const json = JSON.parse(message); // ctx.body = json; ctx.status = 400; } }; };