summaryrefslogtreecommitdiffstats
path: root/nova/exception.py
diff options
context:
space:
mode:
authorTushar Patil <tushar.vitthal.patil@gmail.com>2011-08-09 16:26:12 -0700
committerTushar Patil <tushar.vitthal.patil@gmail.com>2011-08-09 16:26:12 -0700
commit8a8b71b2eaf72b03c0c2bc847b449d2d640fc6c0 (patch)
treeb5be7eacff26e098b93eff60b90e57a25160cb6c /nova/exception.py
parent96631a9e1188d1781381cafc409c2ec3ead895fb (diff)
parent4b3165429797d40da17f5c59aaeadb00673b71b2 (diff)
downloadnova-8a8b71b2eaf72b03c0c2bc847b449d2d640fc6c0.tar.gz
nova-8a8b71b2eaf72b03c0c2bc847b449d2d640fc6c0.tar.xz
nova-8a8b71b2eaf72b03c0c2bc847b449d2d640fc6c0.zip
Merged with trunk
Diffstat (limited to 'nova/exception.py')
-rw-r--r--nova/exception.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/nova/exception.py b/nova/exception.py
index c050da58f..e3e042729 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
@@ -206,6 +213,12 @@ class InvalidContentType(Invalid):
message = _("Invalid content type %(content_type)s.")
+# Cannot be templated as the error syntax varies.
+# msg needs to be constructed when raised.
+class InvalidParameterValue(Invalid):
+ message = _("%(err)s")
+
+
class InstanceNotRunning(Invalid):
message = _("Instance %(instance_id)s is not running.")