mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
refactor: cast correct error type
This commit is contained in:
parent
87e0f594df
commit
b86bd81ed2
1 changed files with 2 additions and 2 deletions
|
|
@ -132,8 +132,8 @@ const translateController: AppController = async (c) => {
|
|||
|
||||
dittoTranslations.set(translatedId, { data: mastodonTranslation });
|
||||
return c.json(mastodonTranslation, 200);
|
||||
} catch (e: any) {
|
||||
if (e.message?.includes('not supported')) {
|
||||
} catch (e) {
|
||||
if (e instanceof Error && e.message?.includes('not supported')) {
|
||||
return c.json({ error: `Translation of source language '${event.language}' not supported` }, 422);
|
||||
}
|
||||
return c.json({ error: 'Service Unavailable' }, 503);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue