Class: GitHub::RateLimitExceededError

Inherits:
Error
  • Object
show all
Defined in:
Library/Homebrew/utils/github.rb

Instance Method Summary collapse

Constructor Details

#initialize(reset, error) ⇒ RateLimitExceededError

Returns a new instance of RateLimitExceededError



18
19
20
21
22
23
24
25
# File 'Library/Homebrew/utils/github.rb', line 18

def initialize(reset, error)
  super <<~EOS
    GitHub API Error: #{error}
    Try again in #{pretty_ratelimit_reset(reset)}, or create a personal access token:
      #{ALL_SCOPES_URL}
    and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token"
  EOS
end

Instance Method Details

#pretty_ratelimit_reset(reset) ⇒ Object



27
28
29
# File 'Library/Homebrew/utils/github.rb', line 27

def pretty_ratelimit_reset(reset)
  pretty_duration(Time.at(reset) - Time.now)
end