Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API errors aren't in JSON #15

Closed
spinler opened this issue Dec 3, 2018 · 3 comments
Closed

REST API errors aren't in JSON #15

spinler opened this issue Dec 3, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@spinler
Copy link
Contributor

spinler commented Dec 3, 2018

The Robot CI tests needs responses like:

curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET   https://XXX/xyz/openbmc_project/blah
{
  "data": {
    "description": "org.freedesktop.DBus.Error.FileNotFound: path or object not found: /xyz/openbmc_project/blah"
  }, 
  "message": "404 Not Found", 
  "status": "error"
}

instead of:

$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET   https://XXX/xy_project/blah
Not Found
@edtanous
Copy link
Contributor

edtanous commented Dec 6, 2018

Agreed, this needs to be improved.
It should just be a matter of hunting through https://github.com/openbmc/bmcweb/blob/master/include/openbmc_dbus_rest.hpp

And look for all calls to res.result, and append a call to res.jsonValue = {json payload I want}

Recently, for redfish error codes, we've moved to a different mechanism where the result code is set as part of a single error handler. (see methods in https://github.com/openbmc/bmcweb/blob/master/redfish-core/include/error_messages.hpp). I imagine a similar pattern might be useful in this case, although might be overkill.

@edtanous edtanous added the bug Something isn't working label Dec 6, 2018
@spinler
Copy link
Contributor Author

spinler commented Dec 7, 2018

I started working on this, and have a few of the paths finished and up in gerrit so far.

@spinler
Copy link
Contributor Author

spinler commented Dec 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants