summaryrefslogtreecommitdiff
path: root/lib/bundler/fetcher/index.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-08-10 21:37:15 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-08-16 15:03:38 +0900
commitfe240b672b709e800f2b4fb996f04f2005329dab (patch)
treedc70b846c0c51d0bdb54a57ea5e5b0a4b4b6db4b /lib/bundler/fetcher/index.rb
parente678affe70d7597464368197fb55d277f0c26bab (diff)
[rubygems/rubygems] Show better error when PAT can't authenticate to a private server
Before: ``` Fetching gem metadata from https://rubygems.org/........ Fetching source index from https://rubygems.pkg.github.com/my-org/ Bad username or password for https://x-access-token@rubygems.pkg.github.com/my-org/. Please double-check your credentials and correct them. ``` After: ``` Fetching gem metadata from https://rubygems.org/........ Fetching source index from https://rubygems.pkg.github.com/my-org/ Access token could not be authenticated for https://x-access-token@rubygems.pkg.github.com/my-org/. Make sure it's valid and has the necessary scopes configured. ``` https://github.com/rubygems/rubygems/commit/2ae69c964a
Diffstat (limited to 'lib/bundler/fetcher/index.rb')
-rw-r--r--lib/bundler/fetcher/index.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb
index 6bb9fcc193..c623647f01 100644
--- a/lib/bundler/fetcher/index.rb
+++ b/lib/bundler/fetcher/index.rb
@@ -15,8 +15,7 @@ module Bundler
raise BadAuthenticationError, remote_uri if remote_uri.userinfo
raise AuthenticationRequiredError, remote_uri
when /403/
- raise BadAuthenticationError, remote_uri if remote_uri.userinfo
- raise AuthenticationRequiredError, remote_uri
+ raise AuthenticationForbiddenError, remote_uri
else
raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>"
end