handle error translating
This commit is contained in:
parent
b49ed95f05
commit
faa411f02a
1 changed files with 9 additions and 5 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue