Exception: GitHub::RateLimitExceededError

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

Instance Attribute Summary

Attributes inherited from Error

#github_message

Instance Method Summary collapse

Constructor Details

#initialize(reset, github_message) ⇒ RateLimitExceededError

Returns a new instance of RateLimitExceededError



32
33
34
35
36
37
38
39
40
# File 'brew/Library/Homebrew/utils/github.rb', line 32

def initialize(reset, github_message)
  @github_message = github_message
  super <<~EOS
    GitHub API Error: #{github_message}
    Try again in #{pretty_ratelimit_reset(reset)}, or create a personal access token:
      #{ALL_SCOPES_URL}
    #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
  EOS
end

Instance Method Details

#pretty_ratelimit_reset(reset) ⇒ Object



42
43
44
# File 'brew/Library/Homebrew/utils/github.rb', line 42

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