summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Tran <jtran@attinteractive.com>2011-04-06 19:13:18 -0700
committerJohn Tran <jtran@attinteractive.com>2011-04-06 19:13:18 -0700
commit430975c2f7e354838a26cd81e59b5c0423a2c8fe (patch)
treef70542d82c5be19d3e4fdafd3d985090b4653f24
parent7bd99e33796f1e90b6f8b0b9caa122c541f99015 (diff)
ApiError code should default to None, and will only display a code if one exists. Prior was output an 'ApiError: ApiError: error message' string, which is confusing
-rw-r--r--nova/exception.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/exception.py b/nova/exception.py
index 4e2bbdbaf..c0bc68b6c 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -46,10 +46,14 @@ class Error(Exception):
class ApiError(Error):
- def __init__(self, message='Unknown', code='ApiError'):
+ def __init__(self, message='Unknown', code=None):
self.message = message
self.code = code
- super(ApiError, self).__init__('%s: %s' % (code, message))
+ if code:
+ outstr = '%s: %s' % (code, message)
+ else:
+ outstr = '%s' % message
+ super(ApiError, self).__init__(outstr)
class NotFound(Error):