summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-09-28 17:26:26 +0000
committerGerrit Code Review <review@openstack.org>2011-09-28 17:26:26 +0000
commitebec34e374bd9ec5354e3648a6e8f3ce26c951b5 (patch)
tree2c3885722bd11fa40a2174b81b6b153fbbb28a0a
parent00bb8f9d03f18ce6efbf128cef6d07bbfe99677f (diff)
parent82bef282c93a574ee5cfb2b34e0d8c077c2a7efe (diff)
downloadnova-ebec34e374bd9ec5354e3648a6e8f3ce26c951b5.tar.gz
nova-ebec34e374bd9ec5354e3648a6e8f3ce26c951b5.tar.xz
nova-ebec34e374bd9ec5354e3648a6e8f3ce26c951b5.zip
Merge "Accept message as sole argument to NovaException"
-rw-r--r--nova/exception.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/nova/exception.py b/nova/exception.py
index f587173e1..775d9b61f 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -138,17 +138,17 @@ class NovaException(Exception):
"""
message = _("An unknown exception occurred.")
- def __init__(self, **kwargs):
+ def __init__(self, message=None, **kwargs):
self.kwargs = kwargs
- try:
- self._error_string = self.message % kwargs
+ if not message:
+ try:
+ message = self.message % kwargs
- except Exception:
- # at least get the core message out if something happened
- self._error_string = self.message
+ except Exception as e:
+ # at least get the core message out if something happened
+ message = self.message
- def __str__(self):
- return self._error_string
+ super(NovaException, self).__init__(message)
class ImagePaginationFailed(NovaException):
@@ -168,7 +168,7 @@ class NotAuthorized(NovaException):
message = _("Not authorized.")
def __init__(self, *args, **kwargs):
- super(NotAuthorized, self).__init__(**kwargs)
+ super(NotAuthorized, self).__init__(*args, **kwargs)
class AdminRequired(NotAuthorized):
@@ -317,7 +317,7 @@ class NotFound(NovaException):
message = _("Resource could not be found.")
def __init__(self, *args, **kwargs):
- super(NotFound, self).__init__(**kwargs)
+ super(NotFound, self).__init__(*args, **kwargs)
class FlagNotSet(NotFound):