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']}", url=f"{self.config['libretranslate_url']}",
data=data, data=data,
) )
self._log.debug( try:
"Response: %s", translation = response.json()['translatedText']
response.content except Exception as error:
) self._log.error(
translation = response.json()['translatedText'] "Error translating '%s' from '%s' to '%s'",
text,
source_language,
destination_language
)
return translation return translation
def _init_log(self): def _init_log(self):