Exception: GitHub::AuthenticationFailedError 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 authentication fails.

Instance Attribute Summary

Attributes inherited from Error

#github_message

Instance Method Summary collapse

Constructor Details

#initialize(github_message) ⇒ AuthenticationFailedError

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 AuthenticationFailedError.


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'Library/Homebrew/utils/github.rb', line 53

def initialize(github_message)
  @github_message = github_message
  message = +"GitHub #{github_message}:"
  message << if Homebrew::EnvConfig.github_api_token
    <<~EOS
      HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check:
        #{Formatter.url("https://github.com/settings/tokens")}
    EOS
  else
    <<~EOS
      The GitHub credentials in the macOS keychain may be invalid.
      Clear them with:
        printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase
      Or create a personal access token:
        #{ALL_SCOPES_URL}
      #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
    EOS
  end
  super message.freeze
end