temporary: add recursive error handler to MastodonApiServerService.ts

This commit is contained in:
Hazelnoot 2025-05-06 13:02:02 -04:00
parent cd4fbc851b
commit 317f5602fe

View file

@ -47,12 +47,16 @@ export class MastodonApiServerService {
this.serverUtilityService.addFlattenedQueryType(fastify); this.serverUtilityService.addFlattenedQueryType(fastify);
fastify.setErrorHandler((error, request, reply) => { fastify.setErrorHandler((error, request, reply) => {
const data = getErrorData(error); try {
const status = getErrorStatus(error); const data = getErrorData(error);
const status = getErrorStatus(error);
this.logger.error(request, data, status); this.logger.error(request, data, status);
reply.code(status).send(data); reply.code(status).send(data);
} catch (e) {
this.logger.logger.error('Recursive error in mastodon API - this is a bug!', { e }, true);
}
}); });
// External endpoints // External endpoints