Exception: GraphQL::ExecutionError
- Defined in:
- lib/graphql/execution_error.rb
Overview
If a field’s resolve function returns a ExecutionError, the error will be inserted into the response’s ‘“errors”` key and the field will resolve to `nil`.
Direct Known Subclasses
AnalysisError, Query::OperationNameMissingError, Query::VariableValidationError, Schema::TimeoutMiddleware::TimeoutError
Instance Attribute Summary collapse
-
#ast_node ⇒ GraphQL::Language::Nodes::Field
The field where the error occured.
Instance Method Summary collapse
-
#to_h ⇒ Hash
An entry for the response’s “errors” key.
Instance Attribute Details
#ast_node ⇒ GraphQL::Language::Nodes::Field
Returns the field where the error occured.
7 8 9 |
# File 'lib/graphql/execution_error.rb', line 7 def ast_node @ast_node end |
Instance Method Details
#to_h ⇒ Hash
Returns An entry for the response’s “errors” key.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/graphql/execution_error.rb', line 10 def to_h hash = { "message" => , } if ast_node hash["locations"] = [ { "line" => ast_node.line, "column" => ast_node.col, } ] end hash end |