Exception: GitHub::API::RateLimitExceededError Private

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

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Error when the API rate limit is exceeded.

Instance Attribute Summary collapse

Attributes inherited from Error

#github_message

Instance Method Summary collapse

Methods included from Utils::Output::Mixin

#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled

Constructor Details

#initialize(reset, github_message) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • reset (Integer)
  • github_message (String)


70
71
72
73
74
75
76
77
78
# File 'utils/github/api.rb', line 70

def initialize(reset, github_message)
  @reset = T.let(reset, Integer)
  new_pat_message = ", or:\n#{GitHub.pat_blurb}" if API.credentials.blank?
  message = <<~EOS
    GitHub API Error: #{github_message}
    Try again in #{pretty_ratelimit_reset}#{new_pat_message}
  EOS
  super(message, github_message)
end

Instance Attribute Details

#resetInteger (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Integer)


81
82
83
# File 'utils/github/api.rb', line 81

def reset
  @reset
end

Instance Method Details

#pretty_ratelimit_resetString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



84
85
86
# File 'utils/github/api.rb', line 84

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