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']}",
|
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):
|
||||||
|
|
Loading…
Reference in a new issue