Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #5579 - bundler:seg-downloader-error, r=colby-swandale
Browse files Browse the repository at this point in the history
[Downloader] Print underlying error in HTTPError

Closes #5577
  • Loading branch information
bundlerbot committed Apr 14, 2017
2 parents fe617da + 17a6487 commit f7acf8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/bundler/fetcher/downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ def request(uri, options)
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

Expand Down
6 changes: 3 additions & 3 deletions spec/bundler/fetcher/downloader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@

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
Expand All @@ -233,7 +233,7 @@

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://[email protected]/api/v2/endpoint")
"Network error while fetching http://[email protected]/api/v2/endpoint (other error about network)")
end
end
end
Expand All @@ -243,7 +243,7 @@

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
Expand Down

0 comments on commit f7acf8c

Please sign in to comment.