diff options
| author | David Cramer <dcramer@gmail.com> | 2017-02-26 12:24:48 -0800 |
|---|---|---|
| committer | David Cramer <dcramer@gmail.com> | 2017-02-26 12:24:48 -0800 |
| commit | af910c71baa218680ac5ad59916f9745fda4c62a (patch) | |
| tree | 371f796e03ef57e73163419299379404cb8b77b8 | |
| parent | e15779f13cdb2471baca3653ccecf9014d00d87f (diff) | |
| download | raven-ref/throw-import-error.tar.gz | |
Throw ImportError on import_string failureref/throw-import-error
| -rw-r--r-- | raven/utils/imports.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/raven/utils/imports.py b/raven/utils/imports.py index fc0dce9..cf8d067 100644 --- a/raven/utils/imports.py +++ b/raven/utils/imports.py @@ -13,4 +13,7 @@ def import_string(key): module_name, class_name = key.rsplit('.', 1) module = __import__(module_name, {}, {}, [class_name], 0) - return getattr(module, class_name) + try: + return getattr(module, class_name) + except AttributeError as ex: + raise ImportError(unicode(ex)) |
