diff options
author | Boris Pavlovic <boris@pavlovic.me> | 2013-06-14 17:53:53 +0400 |
---|---|---|
committer | Boris Pavlovic <boris@pavlovic.me> | 2013-06-22 00:09:22 +0400 |
commit | 616098dcd36b20e01d38898b8942003df664e6ac (patch) | |
tree | 0000b9be01d6c6aa565a687c5490def7075bb0d4 /nova/exception.py | |
parent | d147af21db2db77f578e527883cf2c68abc56496 (diff) | |
download | nova-616098dcd36b20e01d38898b8942003df664e6ac.tar.gz nova-616098dcd36b20e01d38898b8942003df664e6ac.tar.xz nova-616098dcd36b20e01d38898b8942003df664e6ac.zip |
Do not raise NEW exceptions
Raising NEW exception is bad practice, because we lose TraceBack.
So all places like:
except SomeException as e:
raise e
should be replaced by
except SomeException:
raise
If we are doing some other actions before reraising we should
store information about exception then do all actions and then
reraise it. This is caused by eventlet bug. It lost information
about exception if it switch threads.
fixes bug 1191730
Change-Id: Ia375ecef9f16bda65d5146d14ed4b37a988abb0c
Diffstat (limited to 'nova/exception.py')
-rw-r--r-- | nova/exception.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/nova/exception.py b/nova/exception.py index 68cf1f991..002e47a38 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -25,6 +25,7 @@ SHOULD include dedicated exception logging. """ import functools +import sys from oslo.config import cfg import webob.exc @@ -127,7 +128,8 @@ class NovaException(Exception): try: message = self.message % kwargs - except Exception as e: + except Exception: + exc_info = sys.exc_info() # kwargs doesn't match a variable in the message # log the issue and the kwargs LOG.exception(_('Exception in string format operation')) @@ -135,7 +137,7 @@ class NovaException(Exception): LOG.error("%s: %s" % (name, value)) if CONF.fatal_exception_format_errors: - raise e + raise exc_info[0], exc_info[1], exc_info[2] else: # at least get the core message out if something happened message = self.message |