From 70f6ba6bef59c359f41d9f746976295be7c670cd Mon Sep 17 00:00:00 2001 From: Jatin Dhankhar Date: Mon, 6 Jul 2020 23:47:03 +0530 Subject: [PATCH] Refactor rate limited errors to a constant --- lib/octokit/error.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/octokit/error.rb b/lib/octokit/error.rb index aa4118350..121f96b12 100644 --- a/lib/octokit/error.rb +++ b/lib/octokit/error.rb @@ -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 @@ -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