mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 12:15:33 +01:00
Better OSError handling for YAML parser
This commit is contained in:
parent
923a5990c7
commit
11d55fec4f
@ -48,8 +48,9 @@ def load_yaml(fname):
|
|||||||
with codecs.open(fname, encoding='utf-8') as conf_file:
|
with codecs.open(fname, encoding='utf-8') as conf_file:
|
||||||
return yaml.load(conf_file, Loader=SafeLineLoader) or OrderedDict()
|
return yaml.load(conf_file, Loader=SafeLineLoader) or OrderedDict()
|
||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
_LOGGER.error(exc)
|
|
||||||
raise ESPHomeYAMLError(exc)
|
raise ESPHomeYAMLError(exc)
|
||||||
|
except IOError as exc:
|
||||||
|
raise ESPHomeYAMLError(u"Error accessing file {}: {}".format(fname, exc))
|
||||||
except UnicodeDecodeError as exc:
|
except UnicodeDecodeError as exc:
|
||||||
_LOGGER.error(u"Unable to read file %s: %s", fname, exc)
|
_LOGGER.error(u"Unable to read file %s: %s", fname, exc)
|
||||||
raise ESPHomeYAMLError(exc)
|
raise ESPHomeYAMLError(exc)
|
||||||
|
Loading…
Reference in New Issue
Block a user