Added more structure and tests to our authorization code

This commit is contained in:
Tom Moor
2018-02-18 00:11:48 -08:00
parent b53749c95c
commit 2f81eb5e87
9 changed files with 138 additions and 19 deletions

View File

@ -38,6 +38,11 @@ api.use(async (ctx, next) => {
}
}
if (message.match('Authorization error')) {
ctx.status = 404;
message = 'Not Found';
}
if (ctx.status === 500) {
message = 'Internal Server Error';
ctx.app.emit('error', err, ctx);