REST error body should be parseable by clients

Bug #1158598 reported by Steve Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Jianing Yang

Bug Description

Here is an example of a REST response for an exception:
---
400 Bad Request

The server could not comply with the request since it is either malformed or otherwise incorrect.

 Remote error: StackValidationFailed {'Error': 'Provided KeyName is not registered with nova'}

---
The first 2 lines are redundant and unhelpful. The last line has useful information in a form which is difficult to parse.

It would be good if the response was fully parseable json, something like this:
{
"code": 400,
"title": "Bad Request",
"explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.",
"error": {
  "type": "StackValidationFailed",
  "message": "Provided KeyName is not registered with nova",
  "field": "KeyName" **
}

** bonus points for providing a field so something in the UI can be highlighted.

Steven Hardy (shardy)
Changed in heat:
importance: Undecided → Medium
status: New → Triaged
milestone: none → havana-1
Steven Hardy (shardy)
Changed in heat:
milestone: havana-1 → havana-2
Zane Bitter (zaneb)
Changed in heat:
assignee: Zane Bitter (zaneb) → nobody
Changed in heat:
assignee: nobody → Steve Baker (steve-stevebaker)
milestone: havana-2 → havana-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/36678

Changed in heat:
assignee: Steve Baker (steve-stevebaker) → Jianing YANG (jianingy)
status: Triaged → In Progress
Changed in heat:
assignee: Jianing YANG (jianingy) → Steve Baker (steve-stevebaker)
Changed in heat:
assignee: Steve Baker (steve-stevebaker) → Jianing YANG (jianingy)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/36678
Committed: http://github.com/openstack/heat/commit/c5ab33614b465be28d823072ab1fc897313ae6f3
Submitter: Jenkins
Branch: master

commit c5ab33614b465be28d823072ab1fc897313ae6f3
Author: Jianing YANG <email address hidden>
Date: Thu Jul 11 23:17:52 2013 +0800

    make heat-api return a parsable error

    add a wsgi middleware (faultwrap) that catches exceptions
    and transform those exceptions into a parsable format
    according to 'Content-Type' of the request.

    Fixes bug 1158598
    Implements blueprint exception-formatting

    Change-Id: Iacdb8cc119b250ff1e39c99b7a7f66fd4c35e7d9

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: havana-3 → 2013.2
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.