mirror of
https://github.com/aljazceru/ditto.git
synced 2026-02-10 07:54:19 +01:00
feat: return translation not supported error to the frontend
This commit is contained in:
@@ -132,7 +132,10 @@ const translateController: AppController = async (c) => {
|
||||
|
||||
dittoTranslations.set(translatedId, { data: mastodonTranslation });
|
||||
return c.json(mastodonTranslation, 200);
|
||||
} catch {
|
||||
} catch (e: any) {
|
||||
if (e.message?.includes('not supported') || e.error?.includes('not supported')) {
|
||||
return c.json({ error: `Translation of source language '${event.language}' not supported` }, 422);
|
||||
}
|
||||
return c.json({ error: 'Service Unavailable' }, 503);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user