Exception: GitHub::RateLimitExceededError Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Error when the API rate limit is exceeded.

Instance Attribute Summary

Attributes inherited from Error

#github_message

Instance Method Summary collapse

Constructor Details

#initialize(reset, github_message) ⇒ RateLimitExceededError

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RateLimitExceededError.


36
37
38
39
40
41
42
43
44
# File 'Library/Homebrew/utils/github.rb', line 36

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


46
47
48
# File 'Library/Homebrew/utils/github.rb', line 46

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