error messages should have details

Bug #798969 reported by Shivan Bindal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

--- REQUEST: ----
request type : Net::HTTP::Get
request path : "/v1.1/servers/26/ips"
request headers : {"accept"=>["application/json"], "x-auth-token"=>["f895af25c6b877c7bee8f5fc94fffd591ba29a7d"], "content-type"=>["application/json"], "user-agent"=>[""], "host"=>["50.56.22.22:8774"]}
request body : nil
--- RESPONSE: ---
response code : 404
response headers : {"content-type"=>["text/html; charset=UTF-8"], "date"=>["Fri, 27 May 2011 19:10:30 GMT"], "content-length"=>["52"]}
response body : "404 Not Found\n\nThe resource could not be found.\n\n "

Revision history for this message
Thierry Carrez (ttx) wrote :

Could you give more details as to what extra information you would like to have ?

Changed in nova:
status: New → Incomplete
Revision history for this message
Thierry Carrez (ttx) wrote :

@Shivan: could you provide the requested information ? It's necessary for us to understand what you're after.

Revision history for this message
Shivan Bindal (shivan-rightscale) wrote :

Error messages without details; the error 'cloudServersFault' described in API version 1.0:
request type : Net::HTTP::Post
request path : "/v1.1/servers"
request headers : {"accept"=>["application/json"], "user-agent"=>[""], "content-type"=>["application/json"], "x-auth-token"=>["d56ec5ed734b3dfbb79cf586b8e56ec1de2bb6de"], "host"=>["50.56.22.22:8774"], "content-length"=>["24"]}
request body : "{\"server\":{\"name\":null}}"
----------------
response code : 500
response headers : {"content-length"=>["61"], "content-type"=>["application/json; charset=UTF-8"], "date"=>["Fri, 27 May 2011 19:15:40 GMT"]}
response body : "{\"cloudServersFault\": {\"message\": \"'imageRef'\", \"code\": 500}}"

According to this docs http://docs.openstack.org/cactus/openstack-compute/developer/openstack-compute-api-1.1/content/ch03s09s01.html
I expect to receive something like this:

{
    "computeFault" : {
        "code" : 500,
        "message" : "Fault!",
        "details" : "Error Details..."
    }
}

but in response i see only "{\"cloudServersFault\": {\"message\": \"'imageRef'\", \"code\": 500}}" (Structure without details).
it is an essence of this bug.

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

I understand what the doc indicates should happen, but it does not give a real-world example of how details should be used. Personally, I feel like the exception name (something like itemNotFound) and a message such as "Instance 12 could not be found." is more than enough information. The example above where the message is simply 'imageRef' is a poor attempt at logging a KeyError where the request is missing an imageRef attribute. I could see details being used for a traceback, but only if an api debug flag is set to true. What would you like to see in 'details'?

Revision history for this message
Shivan Bindal (shivan-rightscale) wrote :

I just want to know what happened when I sent request and something went wrong. I think message 'imageRef' absolutely uninformative. I don't know what I should change in my request to fix it. So I see only two ways:
1) message field should contains rich description of the error like 'Attribute :imageRef is mandatory.....' . In this case no necessity to specify 'detail' field
2) add details field. It can be like:
{
:code => 500,
:message => 'ParameterError: ....',
:details => 'Parameter :imageRef is mandatory.....'
}

I prefer first option. All what we need is informative error message.

Revision history for this message
Thierry Carrez (ttx) wrote :

I agree we should fix error messages where they are insufficient, but I think we need specific examples.

You submitted two different cases:

* POST /v1.1/servers without imageRef: should be a 4xx with some clue that imageRef is missing
This one is valid -- but a duplicate of bug 816128

* GET /v1.1/servers/26/ips where it doesn't exist: I think 404 / the resource could not be found is the right way to answer...

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

So...is this bug now invalid?

Revision history for this message
Thierry Carrez (ttx) wrote :

Marking Invalid per comment 6, feel free to submit new cases where you think the error message is not appropriate.

Changed in nova:
status: Incomplete → Invalid
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.