module GraphQL::Query::Context::SharedMethods

Public Instance Methods

add_error(error) click to toggle source

Add error at query-level. @param error [GraphQL::ExecutionError] an execution error @return [void]

# File lib/graphql/query/context.rb, line 17
def add_error(error)
  if !error.is_a?(ExecutionError)
    raise TypeError, "expected error to be a ExecutionError, but was #{error.class}"
  end
  errors << error
  nil
end
backtrace() click to toggle source

@example Print the GraphQL backtrace during field resolution

puts ctx.backtrace

@return [GraphQL::Backtrace] The backtrace for this point in query execution

# File lib/graphql/query/context.rb, line 29
def backtrace
  GraphQL::Backtrace.new(self)
end
execution_errors() click to toggle source
# File lib/graphql/query/context.rb, line 33
def execution_errors
  @execution_errors ||= ExecutionErrors.new(self)
end
skip() click to toggle source

Return this value to tell the runtime to exclude this field from the response altogether

# File lib/graphql/query/context.rb, line 10
def skip
  GraphQL::Execution::SKIP
end