Restructuring the folders
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build was killed

This commit is contained in:
2023-05-24 10:24:39 -04:00
parent 1fa308b2a9
commit b969adbc2e
27 changed files with 444 additions and 439 deletions

View File

@@ -0,0 +1,14 @@
import { StatusCodes } from 'http-status-codes';
import { Context, Next } from 'koa';
export const errorHandler = async (ctx: Context, next: Next) => {
try {
await next();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
ctx.status = error.statusCode || error.status || StatusCodes.INTERNAL_SERVER_ERROR;
error.status = ctx.status;
ctx.body = { error };
ctx.app.emit('error', error, ctx);
}
};