Exception: GraphWeaver::Error
- Inherits:
-
StandardError
- Object
- StandardError
- GraphWeaver::Error
- Extended by:
- T::Sig
- 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), InputError (bad variables), ValidationError (build time) — each merging its specifics into #to_h.
Direct Known Subclasses
InputError, QueryError, ServerError, Testing::MissingRecording, TransportError, TypeError, ValidationError
Instance Method Summary collapse
-
#initialize(*args) ⇒ Error
constructor
A new instance of Error.
- #to_h ⇒ Object
Constructor Details
#initialize(*args) ⇒ Error
Returns a new instance of Error.
23 24 25 26 |
# File 'lib/graph_weaver/errors.rb', line 23 def initialize(*args) super GraphWeaver.log(:warn) { "#{self.class.name}: #{}" } end |
Instance Method Details
#to_h ⇒ Object
29 30 31 |
# File 'lib/graph_weaver/errors.rb', line 29 def to_h { "error" => self.class.name, "message" => } end |