diff options
-rw-r--r-- | lib/bundler/fetcher/downloader.rb | 5 | ||||
-rw-r--r-- | spec/bundler/fetcher/downloader_spec.rb | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb index ee1aa1a972..453e4645eb 100644 --- a/lib/bundler/fetcher/downloader.rb +++ b/lib/bundler/fetcher/downloader.rb @@ -58,9 +58,10 @@ module Bundler case e.message when /host down:/, /getaddrinfo: nodename nor servname provided/ raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \ - "connection and try again." + "connection and try again." else - raise HTTPError, "Network error while fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" + raise HTTPError, "Network error while fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" \ + " (#{e})" end end diff --git a/spec/bundler/fetcher/downloader_spec.rb b/spec/bundler/fetcher/downloader_spec.rb index 8b26b8e415..4dcd94b1b2 100644 --- a/spec/bundler/fetcher/downloader_spec.rb +++ b/spec/bundler/fetcher/downloader_spec.rb @@ -222,7 +222,7 @@ RSpec.describe Bundler::Fetcher::Downloader do it "should raise a Bundler::HTTPError" do expect { subject.request(uri, options) }.to raise_error(Bundler::HTTPError, - "Network error while fetching http://www.uri-to-fetch.com/api/v2/endpoint") + "Network error while fetching http://www.uri-to-fetch.com/api/v2/endpoint (other error about network)") end context "when the there are credentials provided in the request" do @@ -233,7 +233,7 @@ RSpec.describe Bundler::Fetcher::Downloader do it "should raise a Bundler::HTTPError that doesn't contain the password" do expect { subject.request(uri, options) }.to raise_error(Bundler::HTTPError, - "Network error while fetching http://username@www.uri-to-fetch.com/api/v2/endpoint") + "Network error while fetching http://username@www.uri-to-fetch.com/api/v2/endpoint (other error about network)") end end end @@ -243,7 +243,7 @@ RSpec.describe Bundler::Fetcher::Downloader do it "should raise a Bundler::Fetcher::HTTPError" do expect { subject.request(uri, options) }.to raise_error(Bundler::HTTPError, - "Network error while fetching http://www.uri-to-fetch.com/api/v2/endpoint") + "Network error while fetching http://www.uri-to-fetch.com/api/v2/endpoint (#{message})") end end end |