diff --git a/src/config/koa.js b/src/config/koa.js index ec1f045..d74fe50 100644 --- a/src/config/koa.js +++ b/src/config/koa.js @@ -16,9 +16,11 @@ const routeErrorHandler = async (ctx, next) => { ctx.status = error.statusCode || error.status || 500; if (!ctx.body) { + const errorDetails = error.message.match('details":\\[(.*)\\]}'); + ctx.body = { errors: { - _global: [error.message], + _global: errorDetails ? [JSON.parse(errorDetails[1])] : [error.message], }, }; }