diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-10 16:40:49 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-10 16:40:49 -0700 |
| commit | ac27df3f4bea1a1a05a84de99c098dc91741a7ee (patch) | |
| tree | 900b14548b0fb0d46b542a6c9644ca36496ec7b3 /nova | |
| parent | ffb2d740a1d8fba997c043cc3066282afedebae8 (diff) | |
make api error messages more readable
Diffstat (limited to 'nova')
| -rwxr-xr-x | nova/endpoint/api.py | 5 | ||||
| -rw-r--r-- | nova/endpoint/cloud.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/nova/endpoint/api.py b/nova/endpoint/api.py index 40be00bb7..12eedfe67 100755 --- a/nova/endpoint/api.py +++ b/nova/endpoint/api.py @@ -304,7 +304,10 @@ class APIRequestHandler(tornado.web.RequestHandler): try: failure.raiseException() except exception.ApiError as ex: - self._error(type(ex).__name__ + "." + ex.code, ex.message) + if ex.code: + self._error(ex.code, ex.message) + else: + self._error(type(ex).__name__, ex.message) # TODO(vish): do something more useful with unknown exceptions except Exception as ex: self._error(type(ex).__name__, str(ex)) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index ad5db6668..adb63351f 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -529,7 +529,7 @@ class CloudController(object): context.project.id, min_instances) raise QuotaError("Instance quota exceeded. You can only " "run %s more instances of this type." % - num_instances) + num_instances, "InstanceLimitExceeded") # make sure user can access the image # vpn image is private so it doesn't show up on lists vpn = kwargs['image_id'] == FLAGS.vpn_image_id |
