Skip to content

Commit

Permalink
Catch unicode decode errors
Browse files Browse the repository at this point in the history
Yaml loader did not catch unicode decode errors as json loader did.

Related to: home-assistant/core#102818
  • Loading branch information
elupus authored Oct 26, 2023
1 parent 059c0df commit fba154d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion supervisor/utils/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fba154d

Please sign in to comment.