[mastodon-client] Return IdentifiableError ID if message is empty

This commit is contained in:
Laura Hausmann 2023-10-07 17:30:49 +02:00
parent f36515a221
commit 47d9278eae
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605

View File

@ -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;