Exception: SpreeMenuChat::RequestError
- Inherits:
-
StandardError
- Object
- StandardError
- SpreeMenuChat::RequestError
- Defined in:
- app/services/spree_menu_chat/request_error.rb
Overview
Shared error class raised by both SpreeMenuChat::LlmClient (Gemini) and SpreeMenuChat::EmbeddingClient (Voyage) on a non-2xx response.
This used to live inline at the bottom of llm_client.rb — that worked in
every spec run (Zeitwerk's eager_load_all, which spec/zeitwerk_spec.rb
exercises, loads every file up front regardless of order) but broke for
real: rails runner autoloads lazily, so calling
SpreeMenuChat::EmbeddingClient without anything having first touched
SpreeMenuChat::LlmClient left RequestError genuinely undefined —
NameError: uninitialized constant SpreeMenuChat::EmbeddingClient:: RequestError, confirmed live while running SpreeMenuChat::ReembedCatalogJob
against the real synced catalog. Zeitwerk expects one constant per file
matching its path; a class defined as a second citizen of another file
only resolves by the accident of load order. Given its own file here, it
autoloads correctly regardless of which client references it first.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status:, body:) ⇒ RequestError
constructor
A new instance of RequestError.
Constructor Details
#initialize(message, status:, body:) ⇒ RequestError
Returns a new instance of RequestError.
20 21 22 23 24 |
# File 'app/services/spree_menu_chat/request_error.rb', line 20 def initialize(, status:, body:) super() @status = status @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
18 19 20 |
# File 'app/services/spree_menu_chat/request_error.rb', line 18 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
18 19 20 |
# File 'app/services/spree_menu_chat/request_error.rb', line 18 def status @status end |