mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 13:16:29 +00:00
Catch unicode decode errors (#4651)
Yaml loader did not catch unicode decode errors as json loader did. Related to: https://github.com/home-assistant/core/issues/102818
This commit is contained in:
parent
059c0df16c
commit
7361d39231
@ -21,7 +21,7 @@ def read_yaml_file(path: Path) -> dict:
|
||||
with open(path, encoding="utf-8") as yaml_file:
|
||||
return load(yaml_file, Loader=SafeLoader) or {}
|
||||
|
||||
except (YAMLError, AttributeError, OSError) as err:
|
||||
except (YAMLError, AttributeError, OSError, UnicodeDecodeError) as err:
|
||||
raise YamlFileError(
|
||||
f"Can't read YAML file {path!s} - {err!s}", _LOGGER.error
|
||||
) from err
|
||||
|
Loading…
x
Reference in New Issue
Block a user