Exception: GraphWeaver::TypeError
- 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.
296 297 298 299 |
# File 'lib/graph_weaver/errors.rb', line 296 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.
294 295 296 |
# File 'lib/graph_weaver/errors.rb', line 294 def struct @struct end |
Instance Method Details
#to_h ⇒ Object
301 302 303 |
# File 'lib/graph_weaver/errors.rb', line 301 def to_h super.merge("struct" => struct.to_s, "cause" => cause&.) end |