mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[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:
parent
d2204044f4
commit
b671133c06
3 changed files with 22 additions and 19 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue