From e9f6e47a92090a9a7867c2a117ae6cf58db394ac Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Tue, 14 Jun 2011 12:36:46 -0400 Subject: [PATCH] Improved errors --- nova/api/openstack/wsgi.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index affc781dcc75..0b749e115e6f 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -76,7 +76,8 @@ class JSONDeserializer(TextDeserializer): try: return utils.loads(datastring) except ValueError: - raise exception.MalformedRequestBody() + raise exception.MalformedRequestBody( + "malformed JSON in request body") class XMLDeserializer(TextDeserializer): @@ -96,7 +97,8 @@ class XMLDeserializer(TextDeserializer): node = minidom.parseString(datastring).childNodes[0] return {node.nodeName: self._from_xml_node(node, plurals)} except ExpatError: - raise exception.MalformedRequestBody() + raise exception.MalformedRequestBody( + "malformed XML in request Body") def _from_xml_node(self, node, listnames): """Convert a minidom node to a simple Python type. @@ -363,7 +365,7 @@ class Resource(wsgi.Application): except exception.InvalidContentType: return webob.exc.HTTPBadRequest(_("Unsupported Content-Type")) except exception.MalformedRequestBody: - explanation = _("Malformed request") + explanation = _("Malformed request body") return faults.Fault(webob.exc.HTTPBadRequest( explanation=explanation))