diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-04-12 11:45:15 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-04-13 21:15:13 -0500 |
commit | 17a6487e309a6a8ab126ad16a1743de72f861034 (patch) | |
tree | 110f71b5d420e1a6f31ab2e7dff83531087c33a7 | |
parent | fe617daaaad4d4d3a48bcce90e39caff9145cfbb (diff) | |
download | bundler-seg-downloader-error.tar.gz |
[Downloader] Print underlying error in HTTPErrorseg-downloader-error
-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 |