diff options
author | Andre Arko <andre@arko.net> | 2015-07-25 14:51:43 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-08-13 10:59:22 -0700 |
commit | 805663f69b43ca400e6d34f819fea5e02290a6f7 (patch) | |
tree | 08095ec4334c3fcf6e419255b4ef9451d3e3c5c3 | |
parent | 6fdbc5d2ac7d794df8044dc7e3c1ce99922e3ff1 (diff) | |
download | bundler-fix-3830.tar.gz |
Rescue Net::HTTPFatalError, toofix-3830
fixes #3830
-rw-r--r-- | lib/bundler/fetcher/index.rb | 3 | ||||
-rw-r--r-- | spec/bundler/fetcher/index_spec.rb | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb index 7f4cff2f09..462fd1db70 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -1,4 +1,5 @@ require "bundler/fetcher/base" +require "rubygems/remote_fetcher" module Bundler class Fetcher @@ -7,7 +8,7 @@ module Bundler old_sources = Bundler.rubygems.sources Bundler.rubygems.sources = [remote_uri.to_s] Bundler.rubygems.fetch_all_remote_specs - rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError => e + rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e case e.message when /certificate verify failed/ raise CertificateFailureError.new(display_uri) diff --git a/spec/bundler/fetcher/index_spec.rb b/spec/bundler/fetcher/index_spec.rb new file mode 100644 index 0000000000..ea6001a4b6 --- /dev/null +++ b/spec/bundler/fetcher/index_spec.rb @@ -0,0 +1,16 @@ +require "bundler" # The error lives here + +describe Bundler::Fetcher::Index do + it "handles Net::HTTPFatalErrors" do + rubygems = double(:sources => [], "sources=" => []) + expect(rubygems).to receive(:fetch_all_remote_specs) { + raise Net::HTTPFatalError.new("nooo", 404) + } + allow(Bundler).to receive(:rubygems).and_return(rubygems) + allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) + + expect { + Bundler::Fetcher::Index.new(nil, nil, nil, nil).specs(%w[foo bar]) + }.to raise_error(Bundler::HTTPError) + end +end |