Skip to content

Commit

Permalink
Refactor rate limited errors to a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
jatindhankhar committed Jul 6, 2020
1 parent 8977c03 commit 70f6ba6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/octokit/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def self.from_response(response)
end

def build_error_context
rate_limited_errors = [Octokit::TooManyRequests, Octokit::AbuseDetected]
if rate_limited_errors.include?(self.class)
if RATE_LIMITED_ERRORS.include?(self.class)
@context = Octokit::RateLimit.from_response(@response)
end
end
Expand Down Expand Up @@ -323,4 +322,5 @@ class ApplicationCredentialsRequired < StandardError; end
# Raised when a repository is created with an invalid format
class InvalidRepository < ArgumentError; end

RATE_LIMITED_ERRORS = [Octokit::TooManyRequests, Octokit::AbuseDetected]
end

0 comments on commit 70f6ba6

Please sign in to comment.