Exception: Collavre::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- Collavre::ApiError
- Defined in:
- app/errors/collavre/api_error.rb
Overview
Raised inside collavre-core API v1 controllers to produce the canonical
single-message JSON envelope { error: "<message>" } at a chosen status,
via the rescue_from in Collavre::Api::V1::BaseController.
NOTE: this is the collavre-core {error: "str"} shape only. It is NOT for
the 422 validation-array shape {errors: [...]} (client retry contract),
nor the OpenAI-nested shape in collavre_completion_api. Do not route those
through this class.
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status: :unprocessable_entity) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(message, status: :unprocessable_entity) ⇒ ApiError
Returns a new instance of ApiError.
15 16 17 18 |
# File 'app/errors/collavre/api_error.rb', line 15 def initialize(, status: :unprocessable_entity) super() @status = status end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'app/errors/collavre/api_error.rb', line 13 def status @status end |