Exception: GraphWeaver::Error
- Inherits:
-
StandardError
- Object
- StandardError
- GraphWeaver::Error
- Defined in:
- lib/graph_weaver/errors.rb
Overview
Base for every error GraphWeaver raises — rescue this to catch them all. #message is the human-friendly side; #to_h is the machine side — a JSON-ready Hash (string keys) for logging, agents, or surfacing structured failures to users. One subclass per failure site — TransportError (never reached the server), ServerError (non-2xx), QueryError (GraphQL-level errors), TypeError (response wouldn't cast), ValidationError (build time) — each merging its specifics into #to_h.
Direct Known Subclasses
QueryError, ServerError, Testing::MissingRecording, TransportError, TypeError, ValidationError
Instance Method Summary collapse
-
#initialize(*args) ⇒ Error
constructor
every GraphWeaver error surfaces on the logger too (see GraphWeaver.logger) — construction here means a raise.
- #to_h ⇒ Object
Constructor Details
#initialize(*args) ⇒ Error
every GraphWeaver error surfaces on the logger too (see GraphWeaver.logger) — construction here means a raise
20 21 22 23 |
# File 'lib/graph_weaver/errors.rb', line 20 def initialize(*args) super GraphWeaver.log(:warn) { "#{self.class.name}: #{}" } end |
Instance Method Details
#to_h ⇒ Object
25 26 27 |
# File 'lib/graph_weaver/errors.rb', line 25 def to_h { "error" => self.class.name, "message" => } end |