summaryrefslogtreecommitdiff
path: root/lib/bundler/fetcher.rb
diff options
context:
space:
mode:
authorJames Wen <jrw2175@columbia.edu>2016-01-01 16:10:40 -0500
committerJames Wen <jrw2175@columbia.edu>2016-01-01 17:43:26 -0500
commit47c1b87d9b02581a99d6195ec76fe97dfd8ff95f (patch)
tree50b391b91963b96a60b5e9be7b51bee85975e17f /lib/bundler/fetcher.rb
parent6b0bc181cd788d4dec7cbaacb51589d68b7cf2a6 (diff)
downloadbundler-47c1b87d9b02581a99d6195ec76fe97dfd8ff95f.tar.gz
Add `Net#HTTP--` errors safely (only if in version of ruby stdlib)
Diffstat (limited to 'lib/bundler/fetcher.rb')
-rw-r--r--lib/bundler/fetcher.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index aaf4679501..7d30506fd6 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -52,10 +52,16 @@ module Bundler
# Exceptions classes that should bypass retry attempts. If your password didn't work the
# first time, it's not going to the third time.
- AUTH_ERRORS = [AuthenticationRequiredError, BadAuthenticationError, Net::HTTPBadGateway,
- Net::HTTPBadRequest, Net::HTTPForbidden, Net::HTTPMethodNotAllowed,
- Net::HTTPMovedPermanently, Net::HTTPNotImplemented, Net::HTTPNotFound,
- Net::HTTPRequestEntityTooLarge, Net::HTTPNoContent]
+ AUTH_ERRORS = [AuthenticationRequiredError, BadAuthenticationError]
+ NET_ERRORS_TO_ADD_SAFELY = [:HTTPBadGateway, :HTTPBadRequest, :HTTPFailedDependency,
+ :HTTPForbidden, :HTTPInsufficientStorage, :HTTPMethodNotAllowed,
+ :HTTPMovedPermanently, :HTTPNoContent, :HTTPNotFound,
+ :HTTPNotImplemented, :HTTPPreconditionFailed, :HTTPRequestEntityTooLarge,
+ :HTTPRequestURITooLong, :HTTPUnauthorized, :HTTPUnprocessableEntity,
+ :HTTPUnsupportedMediaType, :HTTPVersionNotSupported]
+ NET_ERRORS_TO_ADD_SAFELY.each do |net_error|
+ AUTH_ERRORS << Net.const_get(net_error) if Net.constants.include? net_error
+ end
class << self
attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries