diff --git a/bundler/lib/bundler/fetcher/index.rb b/bundler/lib/bundler/fetcher/index.rb index 363d3c0ac652..08b041897eb3 100644 --- a/bundler/lib/bundler/fetcher/index.rb +++ b/bundler/lib/bundler/fetcher/index.rb @@ -19,8 +19,7 @@ def specs(_gem_names) raise BadAuthenticationError, remote_uri if remote_uri.userinfo raise AuthenticationRequiredError, remote_uri else - Bundler.ui.trace e - raise HTTPError, "Could not fetch specs from #{display_uri}" + raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>" end end diff --git a/bundler/spec/bundler/fetcher/index_spec.rb b/bundler/spec/bundler/fetcher/index_spec.rb index dd695b53b7fa..b8ce46321e1b 100644 --- a/bundler/spec/bundler/fetcher/index_spec.rb +++ b/bundler/spec/bundler/fetcher/index_spec.rb @@ -90,7 +90,7 @@ before { allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) } it "should raise a Bundler::HTTPError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com") + expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com due to underlying error ") end end end diff --git a/bundler/spec/realworld/mirror_probe_spec.rb b/bundler/spec/realworld/mirror_probe_spec.rb index 626092c7ebee..a2b5c89150db 100644 --- a/bundler/spec/realworld/mirror_probe_spec.rb +++ b/bundler/spec/realworld/mirror_probe_spec.rb @@ -74,10 +74,10 @@ bundle :install, :artifice => nil, :raise_on_error => false expect(out).to include("Fetching source index from #{mirror}") - expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Could not fetch specs from #{mirror}") + expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error ") end it "prints each error and warning on a new line" do @@ -90,10 +90,10 @@ expect(out).to include "Fetching source index from #{mirror}/" expect(err).to include <<-EOS.strip -Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Could not fetch specs from #{mirror}/ +Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error +Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error +Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error +Could not fetch specs from #{mirror}/ due to underlying error EOS end end @@ -112,10 +112,10 @@ bundle :install, :artifice => nil, :raise_on_error => false expect(out).to include("Fetching source index from #{mirror}") - expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Could not fetch specs from #{mirror}") + expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error ") end end @@ -138,7 +138,7 @@ def setup_server end def setup_mirror - mirror_port = find_unused_port - @mirror_uri = "http://#{host}:#{mirror_port}" + @mirror_port = find_unused_port + @mirror_uri = "http://#{host}:#{@mirror_port}" end end