Permalink
Browse files

bug fix

  • Loading branch information...
1 parent f8ec443 commit 6b0559e11fd0cc3775d755607028feead814e19f @camelmasa camelmasa committed Oct 26, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/faraday/response/raise_octokit_error.rb
@@ -34,11 +34,14 @@ def error_message(response)
if body.is_a?(String)
body = MultiJson.load(body, :symbolize_keys => true)
end
- ": #{body[:errors].map{|e|e[:message]}.join(', ') || body[:error] || body[:message] || ''}"
+ ": #{body[:error] || body[:message] || ''}"
else
''
end
- "#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]}#{message}"
+ errors = unless message.empty?
+ body[:errors] ? ": #{body[:errors].map{|e|e[:message]}.join(', ')}" : ''
+ end
+ "#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]}#{message}#{errors}"
end
end
end

0 comments on commit 6b0559e

Please sign in to comment.