Exception: Recurly::Errors::TransportError

Inherits:
NetworkError show all
Defined in:
lib/recurly/errors/network_errors.rb

Overview

Neutral transport error raised by HTTP adapters for ALL transport-level failures (timeouts, connection failures, SSL errors, generic network errors). This is the single error class the client's retry loop rescues.

The kind symbol (+:timeout+, :connection, :ssl, :network) lets the client reproduce its historical typed-error mapping after retries are exhausted, without needing to know about adapter-specific exception classes. Custom adapters that only set :network degrade gracefully to NetworkError.

Instance Attribute Summary collapse

Attributes inherited from APIError

#recurly_error

Instance Method Summary collapse

Methods inherited from APIError

error_class, from_response, #get_response, #status_code

Constructor Details

#initialize(message, kind: :network, cause: nil) ⇒ TransportError

Returns a new instance of TransportError.



25
26
27
28
29
# File 'lib/recurly/errors/network_errors.rb', line 25

def initialize(message, kind: :network, cause: nil)
  super(message)
  @kind = kind
  @original_exception = cause
end

Instance Attribute Details

#kindSymbol (readonly)

Returns one of :timeout, :connection, :ssl, :network.

Returns:

  • (Symbol)

    one of :timeout, :connection, :ssl, :network



17
18
19
# File 'lib/recurly/errors/network_errors.rb', line 17

def kind
  @kind
end

#original_exceptionException? (readonly)

Returns the underlying transport exception, if any. Named distinctly from Ruby's built-in Exception#cause (which is auto-populated on raise inside a rescue and read by Sentry, logging frameworks, and pp) so we don't shadow it.

Returns:

  • (Exception, nil)

    the underlying transport exception, if any. Named distinctly from Ruby's built-in Exception#cause (which is auto-populated on raise inside a rescue and read by Sentry, logging frameworks, and pp) so we don't shadow it.



23
24
25
# File 'lib/recurly/errors/network_errors.rb', line 23

def original_exception
  @original_exception
end