Commit d4c1bd12 authored by Guido Trotter's avatar Guido Trotter
Browse files

SimpleConfigReader: handle stat() errors



Also, catch EnvironmentError, rather than IOError, when trying to read
the file.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent bcb66fca
......@@ -69,7 +69,11 @@ class SimpleConfigReader(object):
(because we decided it was already up-to-date)
"""
cfg_stat = os.stat(self._file_name)
try:
cfg_stat = os.stat(self._file_name)
except EnvironmentError, err:
raise errors.ConfigurationError("Cannot stat config file %s: %s" %
(self._file_name, err))
inode = cfg_stat.st_ino
mtime = cfg_stat.st_mtime
size = cfg_stat.st_size
......@@ -88,7 +92,7 @@ class SimpleConfigReader(object):
try:
self._config_data = serializer.Load(utils.ReadFile(self._file_name))
except IOError, err:
except EnvironmentError, err:
raise errors.ConfigurationError("Cannot read config file %s: %s" %
(self._file_name, err))
except ValueError, err:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment