diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-08-10 21:37:15 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-08-16 15:03:38 +0900 |
commit | fe240b672b709e800f2b4fb996f04f2005329dab (patch) | |
tree | dc70b846c0c51d0bdb54a57ea5e5b0a4b4b6db4b /lib/bundler/fetcher/downloader.rb | |
parent | e678affe70d7597464368197fb55d277f0c26bab (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/downloader.rb')
-rw-r--r-- | lib/bundler/fetcher/downloader.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb index 28d33f1aed..3062899e0e 100644 --- a/lib/bundler/fetcher/downloader.rb +++ b/lib/bundler/fetcher/downloader.rb @@ -41,6 +41,8 @@ module Bundler when Net::HTTPUnauthorized raise BadAuthenticationError, uri.host if uri.userinfo raise AuthenticationRequiredError, uri.host + when Net::HTTPForbidden + raise AuthenticationForbiddenError, uri.host when Net::HTTPNotFound raise FallbackError, "Net::HTTPNotFound: #{filtered_uri}" else |