Class: MailchimpAPI::NetworkErrorBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mailchimp-api/network_error_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Internal class for building network error instances

Constant Summary collapse

ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

List of network-related error classes that should be wrapped in NetworkError

Returns:

  • (Array<Class>)

    Array of error classes that indicate network issues

[
  IOError,
  Errno::ECONNABORTED,
  Errno::ECONNREFUSED,
  Errno::ECONNRESET,
  Errno::EHOSTUNREACH,
  Errno::EPIPE,
  Errno::ETIMEDOUT,
  OpenSSL::SSL::SSLError,
  SocketError,
  Timeout::Error # Net::OpenTimeout, Net::ReadTimeout
].freeze

Class Method Summary collapse

Class Method Details

.call(request:, error:) ⇒ Errors::NetworkError

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new network error instance

Parameters:

  • request (Request)

    The original request that failed

  • error (StandardError)

    The original network error

Returns:



27
28
29
# File 'lib/mailchimp-api/network_error_builder.rb', line 27

def call(request:, error:)
  Errors::NetworkError.new(error.message, request: request, error: error)
end