From d0af162936b5ad854f96ea3db0e3c3697c1ecc0a Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 10 Aug 2010 15:23:10 -0400 Subject: [PATCH] Log warning for invalid section/option settings --- hooke/config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hooke/config.py b/hooke/config.py index 0135f6b..ea5b2e4 100644 --- a/hooke/config.py +++ b/hooke/config.py @@ -300,12 +300,16 @@ class HookeConfigParser (configparser.RawConfigParser): self, section, *args, **kwargs) for i,kv in enumerate(items): key,value = kv - setting = self._default_settings_dict[(section, key)] + log = logging.getLogger('hooke') + try: + setting = self._default_settings_dict[(section, key)] + except KeyError, e: + log.error('unknown setting %s/%s: %s' % (section, key, e)) + raise try: items[i] = (key, from_string(value=value, type=setting.type, count=setting.count)) except ValueError, e: - log = logging.getLogger('hooke') log.error("could not convert '%s' (%s) for %s/%s: %s" % (value, type(value), section, key, e)) raise -- 2.26.2