summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-04-14 12:17:08 +0000
committerThe Bundler Bot <bot@bundler.io>2017-04-14 12:17:08 +0000
commitf7acf8cfd3fcba1078a1ebd93dbc77ede0fc3517 (patch)
tree110f71b5d420e1a6f31ab2e7dff83531087c33a7
parentfe617daaaad4d4d3a48bcce90e39caff9145cfbb (diff)
parent17a6487e309a6a8ab126ad16a1743de72f861034 (diff)
downloadbundler-f7acf8cfd3fcba1078a1ebd93dbc77ede0fc3517.tar.gz
Auto merge of #5579 - bundler:seg-downloader-error, r=colby-swandale
[Downloader] Print underlying error in HTTPError Closes #5577
-rw-r--r--lib/bundler/fetcher/downloader.rb5
-rw-r--r--spec/bundler/fetcher/downloader_spec.rb6
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