summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-06-11 02:54:35 +0900
committerHomu <homu@barosl.com>2016-06-11 02:54:35 +0900
commit4b57850495e49a0305e738ee09b499d163f1ffa1 (patch)
treebd227b814c95dac1d1aabc885f348867bc8ddb77
parent76e6a9d74d2ba925b60712d3a7b33aef23be9fbc (diff)
parent6c128fd222bc87033f58e31df4efed14c147d43e (diff)
downloadbundler-4b57850495e49a0305e738ee09b499d163f1ffa1.tar.gz
Auto merge of #4661 - allenzhao:issue-4642, r=segiddins
Fail gracefully on Errno::EHOSTUNREACH Close #4642
-rw-r--r--lib/bundler/fetcher.rb2
-rw-r--r--spec/bundler/fetcher/downloader_spec.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index fb9a407791..19611b1725 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 bf6abd115a..bbed835383 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