diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-06-11 05:04:35 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-06-11 05:04:35 +0000 |
commit | ef1db0aeb5f21142935a968bba2bc54f9e3fda2a (patch) | |
tree | 526c990efb132cc0cf5c33d3eb22dac80ef04d49 /nova/api | |
parent | a657af5fd50c8c3b4167c3bc99d9b2021062dc83 (diff) | |
parent | 863b3e45401becbd4ad7452f2bdf43ec2ff87732 (diff) | |
download | nova-ef1db0aeb5f21142935a968bba2bc54f9e3fda2a.tar.gz nova-ef1db0aeb5f21142935a968bba2bc54f9e3fda2a.tar.xz nova-ef1db0aeb5f21142935a968bba2bc54f9e3fda2a.zip |
Merge "Cleanup nova exception message conversion"
Diffstat (limited to 'nova/api')
-rw-r--r-- | nova/api/openstack/compute/contrib/volumes.py | 2 | ||||
-rw-r--r-- | nova/api/openstack/compute/images.py | 4 | ||||
-rw-r--r-- | nova/api/openstack/compute/plugins/v3/servers.py | 8 | ||||
-rw-r--r-- | nova/api/openstack/compute/servers.py | 8 |
4 files changed, 11 insertions, 11 deletions
diff --git a/nova/api/openstack/compute/contrib/volumes.py b/nova/api/openstack/compute/contrib/volumes.py index 3ede9e4a4..0c629f068 100644 --- a/nova/api/openstack/compute/contrib/volumes.py +++ b/nova/api/openstack/compute/contrib/volumes.py @@ -255,7 +255,7 @@ class VolumeController(wsgi.Controller): availability_zone=availability_zone ) except exception.InvalidInput as err: - raise exc.HTTPBadRequest(explanation=str(err)) + raise exc.HTTPBadRequest(explanation=err.format_message()) # TODO(vish): Instance should be None at db layer instead of # trying to lazy load, but for now we turn it into diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py index 4dba0a6c2..e0c4f7465 100644 --- a/nova/api/openstack/compute/images.py +++ b/nova/api/openstack/compute/images.py @@ -181,7 +181,7 @@ class Controller(wsgi.Controller): images = self._image_service.detail(context, filters=filters, **page_params) except exception.Invalid as e: - raise webob.exc.HTTPBadRequest(explanation=str(e)) + raise webob.exc.HTTPBadRequest(explanation=e.format_message()) return self._view_builder.index(req, images) @wsgi.serializers(xml=ImagesTemplate) @@ -201,7 +201,7 @@ class Controller(wsgi.Controller): images = self._image_service.detail(context, filters=filters, **page_params) except exception.Invalid as e: - raise webob.exc.HTTPBadRequest(explanation=str(e)) + raise webob.exc.HTTPBadRequest(explanation=e.format_message()) req.cache_db_items('images', images, 'id') return self._view_builder.detail(req, images) diff --git a/nova/api/openstack/compute/plugins/v3/servers.py b/nova/api/openstack/compute/plugins/v3/servers.py index 5ba249c78..e4dc5db92 100644 --- a/nova/api/openstack/compute/plugins/v3/servers.py +++ b/nova/api/openstack/compute/plugins/v3/servers.py @@ -513,7 +513,7 @@ class ServersController(wsgi.Controller): try: servers = self._get_servers(req, is_detail=False) except exception.Invalid as err: - raise exc.HTTPBadRequest(explanation=str(err)) + raise exc.HTTPBadRequest(explanation=err.format_message()) return servers @wsgi.serializers(xml=ServersTemplate) @@ -522,7 +522,7 @@ class ServersController(wsgi.Controller): try: servers = self._get_servers(req, is_detail=True) except exception.Invalid as err: - raise exc.HTTPBadRequest(explanation=str(err)) + raise exc.HTTPBadRequest(explanation=err.format_message()) return servers def _add_instance_faults(self, ctxt, instances): @@ -625,7 +625,7 @@ class ServersController(wsgi.Controller): utils.check_string_length(value, name, min_length=1, max_length=max_length) except exception.InvalidInput as e: - raise exc.HTTPBadRequest(explanation=str(e)) + raise exc.HTTPBadRequest(explanation=e.format_message()) def _validate_server_name(self, value): self._check_string_length(value, 'Server name', max_length=255) @@ -1455,7 +1455,7 @@ class ServersController(wsgi.Controller): common.raise_http_conflict_for_instance_invalid_state(state_error, 'createImage') except exception.Invalid as err: - raise exc.HTTPBadRequest(explanation=str(err)) + raise exc.HTTPBadRequest(explanation=err.format_message()) # build location of newly-created image entity image_id = str(image['id']) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 41c3b92a5..a996a843b 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -471,7 +471,7 @@ class Controller(wsgi.Controller): try: servers = self._get_servers(req, is_detail=False) except exception.Invalid as err: - raise exc.HTTPBadRequest(explanation=str(err)) + raise exc.HTTPBadRequest(explanation=err.format_message()) return servers @wsgi.serializers(xml=ServersTemplate) @@ -480,7 +480,7 @@ class Controller(wsgi.Controller): try: servers = self._get_servers(req, is_detail=True) except exception.Invalid as err: - raise exc.HTTPBadRequest(explanation=str(err)) + raise exc.HTTPBadRequest(explanation=err.format_message()) return servers def _add_instance_faults(self, ctxt, instances): @@ -583,7 +583,7 @@ class Controller(wsgi.Controller): utils.check_string_length(value, name, min_length=1, max_length=max_length) except exception.InvalidInput as e: - raise exc.HTTPBadRequest(explanation=str(e)) + raise exc.HTTPBadRequest(explanation=e.format_message()) def _validate_server_name(self, value): self._check_string_length(value, 'Server name', max_length=255) @@ -1365,7 +1365,7 @@ class Controller(wsgi.Controller): common.raise_http_conflict_for_instance_invalid_state(state_error, 'createImage') except exception.Invalid as err: - raise exc.HTTPBadRequest(explanation=str(err)) + raise exc.HTTPBadRequest(explanation=err.format_message()) # build location of newly-created image entity image_id = str(image['id']) |