Skip to content

Commit cba9dc6

Browse files
committed
Fix http error handling
1 parent 2214e22 commit cba9dc6

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/buffer/core.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ def interpret_response(response)
5757
end
5858

5959
def handle_response_code(response)
60-
error = Hashie::Mash.new(response.body)
61-
raise Buffer::Error::APIError unless error.code
62-
"Buffer API Error Code: #{error.code}\n" +
63-
"HTTP Code: #{response.code}." +
64-
"Description: #{error.error}"
60+
error = Hashie::Mash.new(JSON.parse(response.body))
61+
raise Buffer::Error::APIError,
62+
"Buffer API Error Code: #{error.code} " +
63+
"HTTP Code: #{response.status}. " +
64+
"Description: #{error.error}"
6565
end
6666
end
6767
end

0 commit comments

Comments
 (0)