FaultWrapper middleware does not respect content types

Bug #790743 reported by Dan Prince
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Dan Prince

Bug Description

The OS API currently uses a FaultWrapper middleware which catches upstream exceptions and converts them into faults. This middleware does not currently respect the request content type. All exceptions are turned into XML response.

Additionally appears the actual error messages on faults are being masked. Fix these issues.

Related branches

Dan Prince (dan-prince)
Changed in nova:
assignee: nobody → Dan Prince (dan-prince)
importance: Undecided → Low
Revision history for this message
Dan Prince (dan-prince) wrote :

So for example this is what is actually returned (for a JSON request) when an error occurs:

 <html> <head> <title>422 Unprocessable Entity</title> </head> <body> <h1>422 Unprocessable Entity</h1> Unable to process the contained instructions<br /><br /> </body> </html>

It should actually be something like this for a JSON request:

 {"cloudServersFault": {"message": "Unable to process the contained instructions", "code": 422}}

Also note that this only happens if the OS API controller actually throws an exception that isn't wrapped in faults.Fault. Many of them are however it seems like we are moving in the direction of just throwing the exceptions unwrapped.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

I don't think it is defaulting to an application/xml response. That is a text/html response, which I think the webob exception is providing.

Dan Prince (dan-prince)
Changed in nova:
status: New → In Progress
Dan Prince (dan-prince)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → diablo-3
Thierry Carrez (ttx)
Changed in nova:
milestone: diablo-3 → 2011.3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.