Method: GraphQL::Query::Executor#result

Defined in:
lib/graphql/query/executor.rb

#resultHash

Evalute GraphQL::Query#operation_name on #query. Handle ExecutionErrors by putting them in the "errors" key.

Returns:

  • (Hash)

    A GraphQL response, with either a "data" key or an "errors" key


18
19
20
21
22
23
# File 'lib/graphql/query/executor.rb', line 18

def result
  execute
rescue GraphQL::ExecutionError => err
  query.context.errors << err
  {"errors" => [err.to_h]}
end