Skip to content

Commit

Permalink
Fixed Response::RaiseOctokitError#error_message
Browse files Browse the repository at this point in the history
The response may be decoded already. See issue #39 for a sample of this
bug.
  • Loading branch information
koraktor committed Jun 16, 2011
1 parent cf6ecc4 commit 4f8c13b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/faraday/response/raise_octokit_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def on_complete(response)

def error_message(response)
message = if body = response[:body]
body = ::MultiJson.decode(body)
body = ::MultiJson.decode(body) if body.is_a? String
": #{body[:error] || body[:message] || ''}"

This comment has been minimized.

Copy link
@glenngillen

glenngillen Nov 25, 2011

Looks like the JSON attribute names are translated to string indexes rather than symbols. At least locally I need to change the above to body["error"] and body["message"].

Didn't want to race ahead and supply a patch as wasn't 100% sure that it's wasn't specific to the JSON library MultiJson has decided to use.

else
''
Expand Down

0 comments on commit 4f8c13b

Please sign in to comment.