diff options
author | Andre Arko <andre@arko.net> | 2014-08-25 19:49:17 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2014-08-25 19:49:17 -0700 |
commit | 0898511a4ea8380a57646a2bd3b7c4bc749c3fd3 (patch) | |
tree | 78586e8a17a1bfce8117a7d616e9f228d3c01b18 | |
parent | d6d63fada2825c1d8cbcd57b0d4fdca199b39aa2 (diff) | |
download | bundler-0898511a4ea8380a57646a2bd3b7c4bc749c3fd3.tar.gz |
error out without retries when the network is down
-rw-r--r-- | lib/bundler/fetcher.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 0512c768e4..4ab2bc67b5 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -166,6 +166,7 @@ module Bundler index = Index.new if gem_names && use_api + fetch(dependency_api_uri) specs = fetch_remote_specs(gem_names) end @@ -192,7 +193,7 @@ module Bundler end index - rescue CertificateFailureError => e + rescue CertificateFailureError, HTTPError => e Bundler.ui.info "" if gem_names && use_api # newline after dots raise e ensure @@ -231,11 +232,9 @@ module Bundler if @remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint @use_api = false - elsif fetch(dependency_api_uri) + else @use_api = true end - rescue HTTPError - @use_api = false end def inspect @@ -299,7 +298,12 @@ module Bundler raise CertificateFailureError.new(uri) rescue *HTTP_ERRORS => e Bundler.ui.trace e - raise HTTPError, "Network error while fetching #{uri}" + if e.message == "getaddrinfo: nodename nor servname provided, or not known" + raise HTTPError, "Could not reach host #{uri.host}. Check your network " \ + "connection and try again." + else + raise HTTPError, "Network error while fetching #{uri}" + end end def dependency_api_uri(gem_names = []) |