change how koa error response is returned

This commit is contained in:
Daniel Rinehart 2017-06-14 15:52:07 -04:00
parent 38bb67bf6f
commit be01aee734

View file

@ -54,6 +54,9 @@ export function graphiqlKoa(options: GraphiQL.GraphiQLData | KoaGraphiQLOptionsF
GraphiQL.resolveGraphiQLString(query, options, ctx).then(graphiqlString => { GraphiQL.resolveGraphiQLString(query, options, ctx).then(graphiqlString => {
ctx.set('Content-Type', 'text/html'); ctx.set('Content-Type', 'text/html');
ctx.body = graphiqlString; ctx.body = graphiqlString;
}, error => ctx.throw(error.message, 500)); }, error => {
ctx.status = 500;
ctx.body = error.message;
});
}; };
} }