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
|
||||||
end
|
end
|
||||||
|
|
||||||
HTTP_ERRORS = [
|
HTTP_ERRORS = Downloader::HTTP_ERRORS
|
||||||
Gem::Timeout::Error,
|
deprecate_constant :HTTP_ERRORS
|
||||||
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
|
|
||||||
|
|
||||||
NET_ERRORS = [
|
NET_ERRORS = [
|
||||||
:HTTPBadGateway,
|
:HTTPBadGateway,
|
||||||
|
|
|
@ -3,6 +3,25 @@
|
||||||
module Bundler
|
module Bundler
|
||||||
class Fetcher
|
class Fetcher
|
||||||
class Downloader
|
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 :connection
|
||||||
attr_reader :redirect_limit
|
attr_reader :redirect_limit
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
|
||||||
let(:error) { RuntimeError.new(message) }
|
let(:error) { RuntimeError.new(message) }
|
||||||
|
|
||||||
before do
|
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 }
|
allow(connection).to receive(:request).with(uri, net_http_get) { raise error }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue