Exception: Sdp::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Sdp::Error
- Defined in:
- lib/sdp/errors.rb
Overview
Base class for every error raised by Sdp::Client.
SDP’s uniform error shape is:
{ "error": { "code": "...", "message": "...", "details": ... }, "meta": { ... } }
The upstream message is preserved as the exception message; the upstream code, HTTP status, details, and meta ride along for logging/branching.
Direct Known Subclasses
BadRequest, ConfigurationError, Conflict, Forbidden, NotFound, RateLimited, SigningPending, Timeout, TransactionFailed, TransferExecutionError, Unauthorized, Unavailable
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Instance Method Summary collapse
-
#initialize(message = nil, code: nil, http_status: nil, details: nil, meta: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message = nil, code: nil, http_status: nil, details: nil, meta: nil) ⇒ Error
Returns a new instance of Error.
14 15 16 17 18 19 20 |
# File 'lib/sdp/errors.rb', line 14 def initialize( = nil, code: nil, http_status: nil, details: nil, meta: nil) super() @code = code @http_status = http_status @details = details @meta = end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
12 13 14 |
# File 'lib/sdp/errors.rb', line 12 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
12 13 14 |
# File 'lib/sdp/errors.rb', line 12 def details @details end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
12 13 14 |
# File 'lib/sdp/errors.rb', line 12 def http_status @http_status end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
12 13 14 |
# File 'lib/sdp/errors.rb', line 12 def @meta end |