Exception: Postio::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Postio::Error
- Defined in:
- lib/postio/errors.rb
Overview
Base class for every Postio API failure.
All instances carry: status (HTTP code, 0 for transport errors), error_code (the API’s error string), details, request_id, and the raw envelope hash for any field this class doesn’t expose.
Direct Known Subclasses
ConnectionError, ForbiddenError, InvalidKeyError, NotFoundError, OutOfCreditError, RateLimitError, ServerError, TimeoutError, ValidationError
Instance Attribute Summary collapse
-
#cause_error ⇒ Object
readonly
Returns the value of attribute cause_error.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#envelope ⇒ Object
readonly
Returns the value of attribute envelope.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status: 0, error_code: nil, details: nil, request_id: nil, envelope: nil, cause: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message, status: 0, error_code: nil, details: nil, request_id: nil, envelope: nil, cause: nil) ⇒ Error
Returns a new instance of Error.
12 13 14 15 16 17 18 19 20 |
# File 'lib/postio/errors.rb', line 12 def initialize(, status: 0, error_code: nil, details: nil, request_id: nil, envelope: nil, cause: nil) super() @status = status @error_code = error_code @details = details @request_id = request_id @envelope = envelope @cause_error = cause end |
Instance Attribute Details
#cause_error ⇒ Object (readonly)
Returns the value of attribute cause_error.
10 11 12 |
# File 'lib/postio/errors.rb', line 10 def cause_error @cause_error end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
10 11 12 |
# File 'lib/postio/errors.rb', line 10 def details @details end |
#envelope ⇒ Object (readonly)
Returns the value of attribute envelope.
10 11 12 |
# File 'lib/postio/errors.rb', line 10 def envelope @envelope end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
10 11 12 |
# File 'lib/postio/errors.rb', line 10 def error_code @error_code end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
10 11 12 |
# File 'lib/postio/errors.rb', line 10 def request_id @request_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/postio/errors.rb', line 10 def status @status end |