From 47d9278eaebb0c162d66bd44af000dac5fbd388b Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sat, 7 Oct 2023 17:30:49 +0200 Subject: [PATCH] [mastodon-client] Return IdentifiableError ID if message is empty --- .../backend/src/server/api/mastodon/middleware/catch-errors.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/backend/src/server/api/mastodon/middleware/catch-errors.ts b/packages/backend/src/server/api/mastodon/middleware/catch-errors.ts index 4019e2c6c..b843a6fb5 100644 --- a/packages/backend/src/server/api/mastodon/middleware/catch-errors.ts +++ b/packages/backend/src/server/api/mastodon/middleware/catch-errors.ts @@ -28,6 +28,7 @@ export async function CatchErrorsMiddleware(ctx: MastoContext, next: () => Promi if (e instanceof MastoApiError) { ctx.status = e.statusCode; } else if (e instanceof IdentifiableError) { + if (e.message.length < 1) e.message = e.id; ctx.status = 400; } else if (e instanceof ApiError) { ctx.status = e.httpStatusCode ?? 500;