storage-upload/api/error.js

13 lines
188 B
JavaScript
Raw Normal View History

2017-12-10 09:45:38 +00:00
export async function errorMiddleware(ctx, next) {
try {
await next()
} catch (e) {
ctx.status = 422
ctx.body = {
status: 422,
message: e.message,
}
}
}