Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

Commit 13c4bc6

Browse files
committed
Merge pull request #5 from pcreux/fix-error-handling
Fix http error handling
2 parents 2c851d4 + cba9dc6 commit 13c4bc6

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
@@ -47,11 +47,11 @@ def interpret_response(response)
4747
end
4848

4949
def handle_response_code(response)
50-
error = Hashie::Mash.new(response.body)
51-
raise Buffer::Error::APIError unless error.code
52-
"Buffer API Error Code: #{error.code}\n" +
53-
"HTTP Code: #{response.code}." +
54-
"Description: #{error.error}"
50+
error = Hashie::Mash.new(JSON.parse(response.body))
51+
raise Buffer::Error::APIError,
52+
"Buffer API Error Code: #{error.code} " +
53+
"HTTP Code: #{response.status}. " +
54+
"Description: #{error.error}"
5555
end
5656
end
5757
end

0 commit comments

Comments
 (0)