lib/aranha/address_processor.rb in aranha-0.17.1 vs lib/aranha/address_processor.rb in aranha-0.18.0

- old
+ new

@@ -1,40 +1,20 @@ # frozen_string_literal: true require 'eac_ruby_utils/core_ext' +require 'aranha/temporary_errors_manager' module Aranha class AddressProcessor - ARANHA_EXCEPTIONS = [::Aranha::Parsers::InvalidStateException].freeze - CORE_EXCEPTIONS = [::SocketError].freeze - ERRNO_EXCEPTIONS = [Errno::ECONNREFUSED, ::Errno::ECONNRESET].freeze - HTTPCLIENT_EXCEPTIONS = [ - ::HTTPClient::BadResponseError, - ::HTTPClient::ConnectTimeoutError, - ::HTTPClient::ReceiveTimeoutError - ].freeze - NET_EXCEPTIONS = [::Net::HTTPFatalError, ::Net::HTTPServerException, ::Net::OpenTimeout].freeze - - NETWORK_EXCEPTIONS = ARANHA_EXCEPTIONS + CORE_EXCEPTIONS + ERRNO_EXCEPTIONS + - HTTPCLIENT_EXCEPTIONS + NET_EXCEPTIONS - - class << self - def rescuable_error?(error) - return true if NETWORK_EXCEPTIONS.any? { |klass| error.is_a?(klass) } - - error.cause.present? ? network_error?(error.cause) : false - end - end - enable_simple_cache common_constructor :address def successful? error.blank? end def rescuable_error? - self.class.rescuable_error?(error) + ::Aranha::TemporaryErrorsManager.temporary_error?(error) end private def error_uncached