Exception: Dinie::APIError
- Defined in:
- lib/dinie/runtime/errors.rb
Overview
Base for everything that originates from talking to the Dinie API.
‘code` and `request_id` are first-class here so every API error answers them (a connection error simply carries `nil`). The extraction logic that reads them off the RFC 9457 body / response headers lives once in APIStatusError, never per marker class — mirroring the V0.2 freeze and the future generator’s “emit once into the base”.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ String?
readonly
Machine-readable error code from the Problem Details ‘code` extension.
-
#request_id ⇒ String?
readonly
Per-request correlation id (from ‘x-request-id`, body fallback).
Instance Method Summary collapse
-
#initialize(message = nil, code: nil, request_id: nil) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(message = nil, code: nil, request_id: nil) ⇒ APIError
Returns a new instance of APIError.
26 27 28 29 30 |
# File 'lib/dinie/runtime/errors.rb', line 26 def initialize( = nil, code: nil, request_id: nil) super() @code = code @request_id = request_id end |
Instance Attribute Details
#code ⇒ String? (readonly)
Returns machine-readable error code from the Problem Details ‘code` extension.
18 19 20 |
# File 'lib/dinie/runtime/errors.rb', line 18 def code @code end |
#request_id ⇒ String? (readonly)
Returns per-request correlation id (from ‘x-request-id`, body fallback).
21 22 23 |
# File 'lib/dinie/runtime/errors.rb', line 21 def request_id @request_id end |