handle error translating

This commit is contained in:
Antonio J. Delgado 2025-02-17 10:29:50 +02:00
parent b49ed95f05
commit faa411f02a

View file

@ -286,11 +286,15 @@ class MastodonEmailBridge:
url=f"{self.config['libretranslate_url']}",
data=data,
)
self._log.debug(
"Response: %s",
response.content
)
try:
translation = response.json()['translatedText']
except Exception as error:
self._log.error(
"Error translating '%s' from '%s' to '%s'",
text,
source_language,
destination_language
)
return translation
def _init_log(self):