Skip to content

Commit c3bfce5

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Simplify non retriable errors list
ruby/rubygems@627a7615f2
1 parent 627ca42 commit c3bfce5

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

lib/bundler/fetcher.rb

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,31 @@ def initialize(remote_uri)
8181

8282
# Exceptions classes that should bypass retry attempts. If your password didn't work the
8383
# first time, it's not going to the third time.
84-
NET_ERRORS = [:HTTPBadGateway, :HTTPBadRequest, :HTTPFailedDependency,
85-
:HTTPForbidden, :HTTPInsufficientStorage, :HTTPMethodNotAllowed,
86-
:HTTPMovedPermanently, :HTTPNoContent, :HTTPNotFound,
87-
:HTTPNotImplemented, :HTTPPreconditionFailed, :HTTPRequestEntityTooLarge,
88-
:HTTPRequestURITooLong, :HTTPUnauthorized, :HTTPUnprocessableEntity,
89-
:HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
90-
FAIL_ERRORS = begin
91-
fail_errors = [AuthenticationRequiredError, BadAuthenticationError, AuthenticationForbiddenError, FallbackError, SecurityError]
92-
fail_errors << Gem::Requirement::BadRequirementError
93-
fail_errors.concat(NET_ERRORS.map {|e| Gem::Net.const_get(e) })
94-
end.freeze
84+
FAIL_ERRORS = [
85+
AuthenticationRequiredError,
86+
BadAuthenticationError,
87+
AuthenticationForbiddenError,
88+
FallbackError,
89+
SecurityError,
90+
Gem::Requirement::BadRequirementError,
91+
Gem::Net::HTTPBadGateway,
92+
Gem::Net::HTTPBadRequest,
93+
Gem::Net::HTTPFailedDependency,
94+
Gem::Net::HTTPForbidden,
95+
Gem::Net::HTTPInsufficientStorage,
96+
Gem::Net::HTTPMethodNotAllowed,
97+
Gem::Net::HTTPMovedPermanently,
98+
Gem::Net::HTTPNoContent,
99+
Gem::Net::HTTPNotFound,
100+
Gem::Net::HTTPNotImplemented,
101+
Gem::Net::HTTPPreconditionFailed,
102+
Gem::Net::HTTPRequestEntityTooLarge,
103+
Gem::Net::HTTPRequestURITooLong,
104+
Gem::Net::HTTPUnauthorized,
105+
Gem::Net::HTTPUnprocessableEntity,
106+
Gem::Net::HTTPUnsupportedMediaType,
107+
Gem::Net::HTTPVersionNotSupported,
108+
].freeze
95109

96110
class << self
97111
attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries

0 commit comments

Comments
 (0)