Apply suggestions from code review

Co-authored-by: Bo Anderson <mail@boanderson.me>
This commit is contained in:
Issy Long 2023-02-07 02:05:46 +01:00 committed by GitHub
parent 41b143deec
commit 87348dc179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,7 @@ module GitHub
class RateLimitExceededError < Error class RateLimitExceededError < Error
def initialize(reset, github_message) def initialize(reset, github_message)
@github_message = github_message @github_message = github_message
new_pat_message = ", or:\n#{pat_blurb}" if API.credentials.blank? new_pat_message = ", or:\n#{GitHub.pat_blurb}" if API.credentials.blank?
super <<~EOS super <<~EOS
GitHub API Error: #{github_message} GitHub API Error: #{github_message}
Try again in #{pretty_ratelimit_reset(reset)}#{new_pat_message} Try again in #{pretty_ratelimit_reset(reset)}#{new_pat_message}
@ -79,7 +79,7 @@ module GitHub
The GitHub credentials in the macOS keychain may be invalid. The GitHub credentials in the macOS keychain may be invalid.
Clear them with: Clear them with:
printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase
#{pat_blurb} #{GitHub.pat_blurb}
EOS EOS
end end
super message.freeze super message.freeze
@ -90,7 +90,7 @@ module GitHub
class MissingAuthenticationError < Error class MissingAuthenticationError < Error
def initialize def initialize
message = +"No GitHub credentials found in macOS Keychain or environment.\n" message = +"No GitHub credentials found in macOS Keychain or environment.\n"
message << pat_blurb message << GitHub.pat_blurb
super message super message
end end
end end
@ -180,7 +180,7 @@ module GitHub
Your #{what} credentials do not have sufficient scope! Your #{what} credentials do not have sufficient scope!
Scopes required: #{needed_scopes} Scopes required: #{needed_scopes}
Scopes present: #{credentials_scopes} Scopes present: #{credentials_scopes}
#{pat_blurb} #{GitHub.pat_blurb}
EOS EOS
end end