diff options
author | Allen Zhao <cnallenzhao@gmail.com> | 2016-06-10 21:16:57 +0800 |
---|---|---|
committer | Allen Zhao <cnallenzhao@gmail.com> | 2016-06-10 21:16:57 +0800 |
commit | 6c128fd222bc87033f58e31df4efed14c147d43e (patch) | |
tree | bd227b814c95dac1d1aabc885f348867bc8ddb77 | |
parent | 76e6a9d74d2ba925b60712d3a7b33aef23be9fbc (diff) | |
download | bundler-6c128fd222bc87033f58e31df4efed14c147d43e.tar.gz |
Fail gracefully on Errno::EHOSTUNREACH
-rw-r--r-- | lib/bundler/fetcher.rb | 2 | ||||
-rw-r--r-- | spec/bundler/fetcher/downloader_spec.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index fb9a4077..19611b17 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -269,7 +269,7 @@ module Bundler Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH, Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, - Net::HTTP::Persistent::Error, Zlib::BufError + Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH ].freeze def bundler_cert_store diff --git a/spec/bundler/fetcher/downloader_spec.rb b/spec/bundler/fetcher/downloader_spec.rb index bf6abd11..bbed8353 100644 --- a/spec/bundler/fetcher/downloader_spec.rb +++ b/spec/bundler/fetcher/downloader_spec.rb @@ -225,6 +225,15 @@ describe Bundler::Fetcher::Downloader do "Network error while fetching http://www.uri-to-fetch.com/api/v2/endpoint") end end + + context "when error message is about no route to host" do + let(:message) { "Failed to open TCP connection to www.uri-to-fetch.com:443 " } + + 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") + end + end end end end |