mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
temporary: add recursive error handler to MastodonApiServerService.ts
This commit is contained in:
parent
cd4fbc851b
commit
317f5602fe
1 changed files with 8 additions and 4 deletions
|
@ -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) => {
|
||||||
|
try {
|
||||||
const data = getErrorData(error);
|
const data = getErrorData(error);
|
||||||
const status = getErrorStatus(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
|
||||||
|
|
Loading…
Add table
Reference in a new issue