Exception: GraphWeaver::QueryError
Overview
Raised when a GraphQL response carried top-level errors and the caller demanded data (Response#data!, or the one-shot GraphWeaver.execute). Carries the structured errors, any partial data, and top-level extensions (cost/throttle metadata).
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
Instance Method Summary collapse
- #codes ⇒ Object
-
#initialize(errors, data: nil, extensions: {}) ⇒ QueryError
constructor
A new instance of QueryError.
- #to_h ⇒ Object
Methods included from ErrorFiltering
#each_error, #entity_id, #errors_at, #errors_by_field, #report, #schema_stale?
Constructor Details
#initialize(errors, data: nil, extensions: {}) ⇒ QueryError
Returns a new instance of QueryError.
338 339 340 341 342 343 |
# File 'lib/graph_weaver/errors.rb', line 338 def initialize(errors, data: nil, extensions: {}) @errors = errors @data = data @extensions = extensions super(summary) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
326 327 328 |
# File 'lib/graph_weaver/errors.rb', line 326 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
323 324 325 |
# File 'lib/graph_weaver/errors.rb', line 323 def errors @errors end |
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
329 330 331 |
# File 'lib/graph_weaver/errors.rb', line 329 def extensions @extensions end |
Instance Method Details
#codes ⇒ Object
347 348 349 |
# File 'lib/graph_weaver/errors.rb', line 347 def codes errors.filter_map(&:code) end |
#to_h ⇒ Object
354 355 356 357 358 359 360 361 |
# File 'lib/graph_weaver/errors.rb', line 354 def to_h super.merge( "schema_stale" => schema_stale?, "codes" => codes, "errors" => errors.map(&:to_h), "extensions" => extensions, ) end |