Exception: OmniSocials::APIError
- Defined in:
- lib/omnisocials/errors.rb
Overview
A non-2xx response from the OmniSocials API.
Attributes:
status - HTTP status code (nil for client-side failures such as a
missing API key at construction time).
code - machine-readable error code from the API body
({"error" => {"code" => ..., "message" => ...}}) when present.
body - the parsed response body (Hash) when the response was JSON,
otherwise the raw response text, or nil.
Direct Known Subclasses
AuthenticationError, NotFoundError, PermissionDeniedError, RateLimitError, ServerError, ValidationError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status: nil, code: nil, body: nil) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(message, status: nil, code: nil, body: nil) ⇒ APIError
Returns a new instance of APIError.
32 33 34 35 36 37 |
# File 'lib/omnisocials/errors.rb', line 32 def initialize(, status: nil, code: nil, body: nil) super() @status = status @code = code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
30 31 32 |
# File 'lib/omnisocials/errors.rb', line 30 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
30 31 32 |
# File 'lib/omnisocials/errors.rb', line 30 def code @code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
30 31 32 |
# File 'lib/omnisocials/errors.rb', line 30 def status @status end |