pksunkara / alpaca

Given a web API, Generate client libraries in node, php, python, ruby
Mozilla Public License 2.0
2.45k stars 89 forks source link

Unable to parse JSON error #70

Closed herkyl closed 9 years ago

herkyl commented 9 years ago

Error responses from API are formatted like this:

500 {"message": "Invalid API token"}

If I understand the documentation correctly I need to add this bit to api.json to parse the error message

"error": {
  "message": "message"
}

However the message does not get returned by the client. I see the error code (500) but the error message itself is in the body parameter and does not get parsed. Am I doing something wrong?

herkyl commented 9 years ago

I digged around in the source and found out that 5XX error messages don't get parsed. I changed my API to return 4XX instead and it works!