Exception: Recurly::Errors::TransportError
- Inherits:
-
NetworkError
- Object
- StandardError
- APIError
- NetworkError
- Recurly::Errors::TransportError
- 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
-
#kind ⇒ Symbol
readonly
One of
:timeout,:connection,:ssl,:network. -
#original_exception ⇒ Exception?
readonly
The underlying transport exception, if any.
Attributes inherited from APIError
Instance Method Summary collapse
-
#initialize(message, kind: :network, cause: nil) ⇒ TransportError
constructor
A new instance of TransportError.
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(, kind: :network, cause: nil) super() @kind = kind @original_exception = cause end |
Instance Attribute Details
#kind ⇒ Symbol (readonly)
Returns one of :timeout, :connection, :ssl, :network.
17 18 19 |
# File 'lib/recurly/errors/network_errors.rb', line 17 def kind @kind end |
#original_exception ⇒ Exception? (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.
23 24 25 |
# File 'lib/recurly/errors/network_errors.rb', line 23 def original_exception @original_exception end |