[rubygems/rubygems] Move Bundler::Fetcher::HTTP_ERRORS to Bundler::Fetcher::DOWNLOADER

And deprecate the old constant.

It's only used in this class, and in Bundler::Fetcher there's already
FAIL_ERRORS, very similar to it. So this makes things less confusing.

d32ed63d6f
This commit is contained in:
David Rodríguez 2025-06-20 13:41:03 +02:00 committed by Hiroshi SHIBATA
parent d2204044f4
commit b671133c06
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
3 changed files with 22 additions and 19 deletions

View file

@ -72,24 +72,8 @@ module Bundler
end
end
HTTP_ERRORS = [
Gem::Timeout::Error,
EOFError,
SocketError,
Errno::EADDRNOTAVAIL,
Errno::ENETDOWN,
Errno::ENETUNREACH,
Errno::EINVAL,
Errno::ECONNRESET,
Errno::ETIMEDOUT,
Errno::EAGAIN,
Gem::Net::HTTPBadResponse,
Gem::Net::HTTPHeaderSyntaxError,
Gem::Net::ProtocolError,
Gem::Net::HTTP::Persistent::Error,
Zlib::BufError,
Errno::EHOSTUNREACH,
].freeze
HTTP_ERRORS = Downloader::HTTP_ERRORS
deprecate_constant :HTTP_ERRORS
NET_ERRORS = [
:HTTPBadGateway,

View file

@ -3,6 +3,25 @@
module Bundler
class Fetcher
class Downloader
HTTP_ERRORS = [
Gem::Timeout::Error,
EOFError,
SocketError,
Errno::EADDRNOTAVAIL,
Errno::ENETDOWN,
Errno::ENETUNREACH,
Errno::EINVAL,
Errno::ECONNRESET,
Errno::ETIMEDOUT,
Errno::EAGAIN,
Gem::Net::HTTPBadResponse,
Gem::Net::HTTPHeaderSyntaxError,
Gem::Net::ProtocolError,
Gem::Net::HTTP::Persistent::Error,
Zlib::BufError,
Errno::EHOSTUNREACH,
].freeze
attr_reader :connection
attr_reader :redirect_limit

View file

@ -206,7 +206,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
let(:error) { RuntimeError.new(message) }
before do
stub_const("Bundler::Fetcher::HTTP_ERRORS", [RuntimeError])
stub_const("#{described_class}::HTTP_ERRORS", [RuntimeError])
allow(connection).to receive(:request).with(uri, net_http_get) { raise error }
end