summaryrefslogtreecommitdiff
path: root/oslo
diff options
context:
space:
mode:
authorDoug Hellmann <doug@doughellmann.com>2014-10-06 11:23:03 -0400
committerDoug Hellmann <doug@doughellmann.com>2014-10-06 11:23:03 -0400
commit64f6062cb4b15995e58b84dbbf4705504030c282 (patch)
tree52883763e7025668f785a3e99aab55829d59b65c /oslo
parent26ec2fcaa233fc26e963424771a6296132d2aefd (diff)
downloadoslo-db-64f6062cb4b15995e58b84dbbf4705504030c282.tar.gz
Improve error reporting for backend import failures
Use import_module instead of try_import so that any import exception includes a full stack trace and the original error message. Change-Id: I64449688f22a224b590807317472f26e64f377a3
Diffstat (limited to 'oslo')
-rw-r--r--oslo/db/api.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/oslo/db/api.py b/oslo/db/api.py
index 8b7bdeb..906e88d 100644
--- a/oslo/db/api.py
+++ b/oslo/db/api.py
@@ -177,10 +177,10 @@ class DBAPI(object):
# Import the untranslated name if we don't have a mapping
backend_path = self._backend_mapping.get(self._backend_name,
self._backend_name)
- backend_mod = importutils.try_import(backend_path)
- if not backend_mod:
- raise ImportError("Unable to import backend '%s'" %
- self._backend_name)
+ LOG.debug('Loading backend %(name)r from %(path)r',
+ {'name': self._backend_name,
+ 'path': backend_path})
+ backend_mod = importutils.import_module(backend_path)
self._backend = backend_mod.get_backend()
def __getattr__(self, key):