summaryrefslogtreecommitdiff
path: root/Lib/logging/config.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-06-02 10:05:31 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-06-02 10:05:31 +0000
commit3b4849a21d691bf95b9d4d4171b60c496e109ae6 (patch)
tree2fd7728901870e6511371dd17f7dba5c717b0857 /Lib/logging/config.py
parent27c72e9e5cc8b2d8d4e632c010ec8bf77360ae4d (diff)
downloadcpython-git-3b4849a21d691bf95b9d4d4171b60c496e109ae6.tar.gz
Logging: improved error reporting for BaseConfigurator.resolve().
Diffstat (limited to 'Lib/logging/config.py')
-rw-r--r--Lib/logging/config.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 07b9d1a834..356183f5ed 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -387,15 +387,21 @@ class BaseConfigurator(object):
"""
name = s.split('.')
used = name.pop(0)
- found = self.importer(used)
- for frag in name:
- used += '.' + frag
- try:
- found = getattr(found, frag)
- except AttributeError:
- self.importer(used)
- found = getattr(found, frag)
- return found
+ try:
+ found = self.importer(used)
+ for frag in name:
+ used += '.' + frag
+ try:
+ found = getattr(found, frag)
+ except AttributeError:
+ self.importer(used)
+ found = getattr(found, frag)
+ return found
+ except ImportError:
+ e, tb = sys.exc_info()[1:]
+ v = ValueError('Cannot resolve %r: %s' % (s, e))
+ v.__cause__, v.__traceback__ = e, tb
+ raise v
def ext_convert(self, value):
"""Default converter for the ext:// protocol."""