diff options
author | Justin Shepherd <jshepher@rackspace.com> | 2013-01-15 04:05:11 +0000 |
---|---|---|
committer | Justin Shepherd <jshepher@rackspace.com> | 2013-01-15 04:07:37 +0000 |
commit | 12e38d98d5ae5a5ffd80e969172fb468af044211 (patch) | |
tree | 1750067d6b359196c09b4cf3a79fde392201622f | |
parent | b097b59c375c853170954724bbc6bdfff24e08ea (diff) | |
download | nova-12e38d98d5ae5a5ffd80e969172fb468af044211.tar.gz nova-12e38d98d5ae5a5ffd80e969172fb468af044211.tar.xz nova-12e38d98d5ae5a5ffd80e969172fb468af044211.zip |
Cleaning up exception handling
bug 1094035
Change-Id: I91e134a3632e6b3314fe90d25e2df780aaba54d1
-rw-r--r-- | nova/api/openstack/compute/servers.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index d3a6fc8a9..f0fdb5a15 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -538,10 +538,10 @@ class Controller(wsgi.Controller): marker=marker) except exception.MarkerNotFound as e: msg = _('marker [%s] not found') % marker - raise webob.exc.HTTPBadRequest(explanation=msg) + raise exc.HTTPBadRequest(explanation=msg) except exception.FlavorNotFound as e: msg = _("Flavor could not be found") - raise webob.exc.HTTPUnprocessableEntity(explanation=msg) + raise exc.HTTPUnprocessableEntity(explanation=msg) if is_detail: self._add_instance_faults(context, instance_list) @@ -828,21 +828,24 @@ class Controller(wsgi.Controller): try: min_count = int(min_count) except ValueError: - raise webob.exc.HTTPBadRequest(_('min_count must be an ' - 'integer value')) + msg = _('min_count must be an integer value') + raise exc.HTTPBadRequest(explanation=msg) if min_count < 1: - raise webob.exc.HTTPBadRequest(_('min_count must be > 0')) + msg = _('min_count must be > 0') + raise exc.HTTPBadRequest(explanation=msg) try: max_count = int(max_count) except ValueError: - raise webob.exc.HTTPBadRequest(_('max_count must be an ' - 'integer value')) + msg = _('max_count must be an integer value') + raise exc.HTTPBadRequest(explanation=msg) if max_count < 1: - raise webob.exc.HTTPBadRequest(_('max_count must be > 0')) + msg = _('max_count must be > 0') + raise exc.HTTPBadRequest(explanation=msg) if min_count > max_count: - raise webob.exc.HTTPBadRequest(_('min_count must be <= max_count')) + msg = _('min_count must be <= max_count') + raise exc.HTTPBadRequest(explanation=msg) auto_disk_config = False if self.ext_mgr.is_loaded('OS-DCF'): @@ -1202,7 +1205,8 @@ class Controller(wsgi.Controller): try: body = body['rebuild'] except (KeyError, TypeError): - raise exc.HTTPBadRequest(_("Invalid request body")) + msg = _('Invalid request body') + raise exc.HTTPBadRequest(explanation=msg) try: image_href = body["imageRef"] |