ordrin/api-ruby — pull request #7 by jfeldstein (2014-11-15 17:10:11+00:00)
Title: Return the response, rather than raising an exception, in the case of a non 0 error code

Calling resp.value raises an exception when a non 200 http code is presented.

This ends up raising a NetHTTP exception, which tells the user an error occurred, but drops the information contained in the response body, including what the error actually was.

IMHO, better to return a response such as:

{
"error" => 1,
"msg" => "The thing that went wrong was...."
}

This matches the pattern of success messages being returned as:

{
"error" => 0
}

And makes it much easier to debug in the case of errors, so others don't have to fork the gem, modify it to print this output and use that fork to debug. They can just capture the exceptions as they occur in production, and deal with them.