Log warning for invalid section/option settings
authorW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 19:23:10 +0000 (15:23 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 19:23:10 +0000 (15:23 -0400)
hooke/config.py

index 0135f6bd35e9ca05f5ac436ed8f492436cd1597b..ea5b2e4f9e262891721e656ceb158fb583041792 100644 (file)
@@ -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