include expected type of config option in error

This commit is contained in:
Unrud 2017-06-02 12:42:40 +02:00
parent 881757815f
commit 1812aeb238

View File

@ -232,6 +232,7 @@ def load(paths=(), extra_config=None, ignore_missing_paths=True):
type_(config.get(section, option))
except Exception as e:
raise RuntimeError(
"Invalid value %r for option %r in section %r in config" %
(config.get(section, option), option, section)) from e
"Invalid %s value for option %r in section %r in config: "
"%r" % (type_.__name__, option, section,
config.get(section, option))) from e
return config