| import { Middleware } from 'koa'; | |
| export const errorMiddleware: Middleware = async (ctx, next) => { | |
| try { | |
| await next(); | |
| } catch (error) { | |
| ctx.status = 500; | |
| ctx.body = { error: error }; | |
| } | |
| }; |
| import { Middleware } from 'koa'; | |
| export const errorMiddleware: Middleware = async (ctx, next) => { | |
| try { | |
| await next(); | |
| } catch (error) { | |
| ctx.status = 500; | |
| ctx.body = { error: error }; | |
| } | |
| }; |