Catch ValueError in google_translate (#42405)

This commit is contained in:
Paulus Schoutsen 2020-10-26 16:38:48 +01:00 committed by GitHub
parent 0de52c173c
commit a12a8350ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -161,7 +161,6 @@ homeassistant/components/goalzero/* @tkdrob
homeassistant/components/gogogate2/* @vangorra
homeassistant/components/google_assistant/* @home-assistant/cloud
homeassistant/components/google_cloud/* @lufton
homeassistant/components/google_translate/* @awarecan
homeassistant/components/gpsd/* @fabaff
homeassistant/components/gree/* @cmroche
homeassistant/components/greeneye_monitor/* @jkeljo

View File

@ -3,5 +3,5 @@
"name": "Google Translate Text-to-Speech",
"documentation": "https://www.home-assistant.io/integrations/google_translate",
"requirements": ["gTTS-token==1.1.3"],
"codeowners": ["@awarecan"]
"codeowners": []
}

View File

@ -123,9 +123,14 @@ class GoogleProvider(Provider):
data = b""
for idx, part in enumerate(message_parts):
part_token = await self.hass.async_add_executor_job(
token.calculate_token, part
)
try:
part_token = await self.hass.async_add_executor_job(
token.calculate_token, part
)
except ValueError as err:
# If token seed fetching fails.
_LOGGER.warning(err)
return None, None
url_param = {
"ie": "UTF-8",