Catch UnicodeDecodeError Error (#4007)

* Catch UnicodeDecodeError Error 

Error for #3933

* Forgot (exc)

* catch...

* Tests by @lwis

* Docstring

* Create open
This commit is contained in:
Johann Kellerman 2016-10-24 03:55:06 +02:00 committed by Paulus Schoutsen
parent 1f89e6ddba
commit 5df8477536
2 changed files with 10 additions and 4 deletions

View file

@ -43,6 +43,9 @@ def load_yaml(fname: str) -> Union[List, Dict]:
except yaml.YAMLError as exc:
_LOGGER.error(exc)
raise HomeAssistantError(exc)
except UnicodeDecodeError as exc:
_LOGGER.error('Unable to read file %s: %s', fname, exc)
raise HomeAssistantError(exc)
def clear_secret_cache() -> None: