Exception: GraphWeaver::TypeError
- Extended by:
- T::Sig
- Defined in:
- lib/graph_weaver/errors.rb
Overview
Raised when a response can't be cast into the generated structs — the wire data disagreed with the types the schema promised at generation time (a nil where non-null was declared, a malformed scalar, an unknown enum value). #struct names the generated type that failed; #cause carries the original TypeError/KeyError with the offending prop in its message.
Instance Attribute Summary collapse
-
#struct ⇒ Object
readonly
Returns the value of attribute struct.
Instance Method Summary collapse
-
#initialize(struct:, error: nil, message: nil) ⇒ TypeError
constructor
A new instance of TypeError.
- #to_h ⇒ Object
Constructor Details
#initialize(struct:, error: nil, message: nil) ⇒ TypeError
Returns a new instance of TypeError.
387 388 389 390 |
# File 'lib/graph_weaver/errors.rb', line 387 def initialize(struct:, error: nil, message: nil) @struct = struct super("failed to cast response into #{struct}: #{ || error&.}") end |
Instance Attribute Details
#struct ⇒ Object (readonly)
Returns the value of attribute struct.
384 385 386 |
# File 'lib/graph_weaver/errors.rb', line 384 def struct @struct end |
Instance Method Details
#to_h ⇒ Object
393 394 395 |
# File 'lib/graph_weaver/errors.rb', line 393 def to_h super.merge("struct" => struct.to_s, "cause" => cause&.) end |