diff options
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 4bf9dbcc4..63eeff3fa 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -253,7 +253,6 @@ module GitHub extend self Error = Class.new(RuntimeError) HTTPNotFoundError = Class.new(Error) - AuthenticationFailedError = Class.new(Error) class RateLimitExceededError < Error def initialize(reset, error) @@ -274,6 +273,16 @@ module GitHub extend self end end + class AuthenticationFailedError < Error + def initialize(error) + super <<-EOS.undent + GitHub #{error} + HOMEBREW_GITHUB_API_TOKEN may be invalid or expired, check: + https://github.com/settings/applications + EOS + end + end + def open url, headers={}, &block # This is a no-op if the user is opting out of using the GitHub API. return if ENV['HOMEBREW_NO_GITHUB_API'] @@ -306,7 +315,7 @@ module GitHub extend self case e.io.status.first when "401", "403" - raise AuthenticationFailedError, e.message, e.backtrace + raise AuthenticationFailedError.new(e.message) when "404" raise HTTPNotFoundError, e.message, e.backtrace else |
