show stack trace from API handler

This commit is contained in:
Johann150 2023-05-23 22:44:56 +02:00
parent e75123602f
commit dfe12cba75
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -45,7 +45,10 @@ export async function handler(endpoint: IEndpoint, ctx: Koa.Context): Promise<vo
if (e instanceof AuthenticationError) {
new ApiError('AUTHENTICATION_FAILED', e.message).apply(ctx, endpoint.name);
} else {
new ApiError().apply(ctx, endpoint.name);
new ApiError('INTERNAL_ERROR', {
e: e.message,
stack: e.stack,
}).apply(ctx, endpoint.name);
}
});
}