Exception: Melaya::MelayaError
- Inherits:
-
StandardError
- Object
- StandardError
- Melaya::MelayaError
- Defined in:
- lib/melaya/errors.rb
Overview
Raised for non-2xx REST responses or ok:false response envelopes.
Two server error shapes are normalised here:
1. { error: 'tier_insufficient', tier: '...' } → HTTP 403
2. { error: '...', message: '...', code: '...' } → other 4xx/5xx
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Raw response body (Hash, String, or nil).
-
#code ⇒ Object
readonly
Short machine-readable error code from the server (String or nil).
-
#status ⇒ Object
readonly
HTTP status code (Integer), or 0 for transport/WS errors.
Instance Method Summary collapse
-
#initialize(message, status: 0, code: nil, body: nil) ⇒ MelayaError
constructor
A new instance of MelayaError.
Constructor Details
#initialize(message, status: 0, code: nil, body: nil) ⇒ MelayaError
Returns a new instance of MelayaError.
18 19 20 21 22 23 |
# File 'lib/melaya/errors.rb', line 18 def initialize(, status: 0, code: nil, body: nil) super() @status = status @code = code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Raw response body (Hash, String, or nil). Not included in #message so secrets embedded in error payloads do not leak to log lines.
16 17 18 |
# File 'lib/melaya/errors.rb', line 16 def body @body end |
#code ⇒ Object (readonly)
Short machine-readable error code from the server (String or nil).
13 14 15 |
# File 'lib/melaya/errors.rb', line 13 def code @code end |
#status ⇒ Object (readonly)
HTTP status code (Integer), or 0 for transport/WS errors.
11 12 13 |
# File 'lib/melaya/errors.rb', line 11 def status @status end |