Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
pass through http error codes and raise rate limit exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
heatonjb committed May 22, 2014
1 parent 810611e commit 03471da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/faraday/raise_http_exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def call(env)
raise Instagram::BadRequest, error_message_400(response)
when 404
raise Instagram::NotFound, error_message_400(response)
when 429
raise Instagram::RateLimitExceeded, error_message_400(response)
when 500
raise Instagram::InternalServerError, error_message_500(response, "Something is technically wrong.")
when 502
Expand Down
3 changes: 3 additions & 0 deletions lib/instagram/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ class GatewayTimeout < Error; end

# Raised when a subscription payload hash is invalid
class InvalidSignature < Error; end

# Raised when Instagram returns the HTTP status code 429
class RateLimitExceeded < Error; end
end
2 changes: 1 addition & 1 deletion lib/instagram/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Instagram
VERSION = '1.0.0'.freeze unless defined?(::Instagram::VERSION)
VERSION = '1.0.1'.freeze unless defined?(::Instagram::VERSION)
end

0 comments on commit 03471da

Please sign in to comment.