1
0

more fixes to Mastodon logging

This commit is contained in:
Hazelnoot
2025-05-06 21:06:33 -04:00
parent b6f4fda80d
commit 9db39d449f
2 changed files with 8 additions and 19 deletions
@@ -51,6 +51,7 @@ export class MastodonApiServerService {
const data = getErrorData(error);
const status = getErrorStatus(error);
const exception = getErrorException(error);
if (exception) {
this.logger.exception(request, exception);
}
@@ -60,7 +61,7 @@ export class MastodonApiServerService {
// Log error responses (including converted JSON exceptions)
fastify.addHook('onSend', (request, reply, payload, done) => {
if (reply.statusCode >= 400 && reply.statusCode <= 500) {
if (reply.statusCode >= 400) {
if (typeof(payload) === 'string' && String(reply.getHeader('content-type')).toLowerCase().includes('application/json')) {
const body = JSON.parse(payload);
const data = getErrorData(body);