summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2011-08-08 19:48:07 +0000
committerTarmac <>2011-08-08 19:48:07 +0000
commit439afc337fec1064ff8eff58625f54f8450dce47 (patch)
tree4394d1173c0293d061de910069b4949189470b94
parent047f6e0351c21ff2caff903731e61f10ac38e59d (diff)
parent9788cddbf7833a82fc5589dd5f2869a309d1f657 (diff)
downloadnova-439afc337fec1064ff8eff58625f54f8450dce47.tar.gz
nova-439afc337fec1064ff8eff58625f54f8450dce47.tar.xz
nova-439afc337fec1064ff8eff58625f54f8450dce47.zip
nova.exception.wrap_exception will re-raise some exceptions, but in the process of possibly notifying that an exception has occurred, it may clobber the current exception information. nova.utils.to_primitive in particular (used by the notifier code) will catch and handle an exception clobbering the current exception being handled in wrap_exception. Eventually when using the bare 'raise', it will attempt to raise None resulting a completely different and unhelpful exception.
The patch saves the exception at the beginning of wrap_exception and then re-raises the original exception avoiding the possibility of a clobbered exception.
-rw-r--r--nova/exception.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/exception.py b/nova/exception.py
index 792e306c1..a87728fff 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -25,6 +25,7 @@ SHOULD include dedicated exception logging.
"""
from functools import wraps
+import sys
from nova import log as logging
@@ -96,6 +97,10 @@ def wrap_exception(notifier=None, publisher_id=None, event_type=None,
try:
return f(*args, **kw)
except Exception, e:
+ # Save exception since it can be clobbered during processing
+ # below before we can re-raise
+ exc_info = sys.exc_info()
+
if notifier:
payload = dict(args=args, exception=e)
payload.update(kw)
@@ -122,7 +127,9 @@ def wrap_exception(notifier=None, publisher_id=None, event_type=None,
LOG.exception(_('Uncaught exception'))
#logging.error(traceback.extract_stack(exc_traceback))
raise Error(str(e))
- raise
+
+ # re-raise original exception since it may have been clobbered
+ raise exc_info[0], exc_info[1], exc_info[2]
return wraps(f)(wrapped)
return inner