Exception: CircleSo::APIError
- Defined in:
- lib/circle_so/errors.rb
Overview
Raised for any non-2xx response from the Circle API. Carries the HTTP status, the parsed response body (Hash when JSON, String otherwise), and a classification kind mirroring the status:
:unauthorized 401 — wrong/invalid token (or a v1 token on the v2 API)
:forbidden 403 — plan no longer allows the endpoint
:not_found 404 with a JSON body — missing record/param
:wrong_path 404 with an HTML body — the route does not exist
:rate_limited 429
:server_error 5xx
:unknown anything else
Direct Known Subclasses
ForbiddenError, NotFoundError, RateLimitedError, ServerError, UnauthorizedError, WrongPathError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status:, body: nil, kind: :unknown) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(message, status:, body: nil, kind: :unknown) ⇒ APIError
Returns a new instance of APIError.
20 21 22 23 24 25 |
# File 'lib/circle_so/errors.rb', line 20 def initialize(, status:, body: nil, kind: :unknown) super() @status = status @body = body @kind = kind end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
18 19 20 |
# File 'lib/circle_so/errors.rb', line 18 def body @body end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
18 19 20 |
# File 'lib/circle_so/errors.rb', line 18 def kind @kind end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
18 19 20 |
# File 'lib/circle_so/errors.rb', line 18 def status @status end |