Skip to content

Commit

Permalink
Handle error when validating options in Google Cloud TTS (home-assist…
Browse files Browse the repository at this point in the history
  • Loading branch information
tronikos authored Jun 30, 2024
1 parent bf60869 commit d55be79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion homeassistant/components/google_cloud/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ async def async_get_tts_audio(self, message, language, options):
vol.Optional(CONF_TEXT_TYPE, default=self._text_type): TEXT_TYPE_SCHEMA,
}
)
options = options_schema(options)
try:
options = options_schema(options)
except vol.Invalid as err:
_LOGGER.error("Error: %s when validating options: %s", err, options)
return None, None

encoding = options[CONF_ENCODING]
gender = texttospeech.SsmlVoiceGender[options[CONF_GENDER]]
Expand Down

0 comments on commit d55be79

Please sign in to comment.