class GraphQL::Execution::Interpreter::ExecutionErrors

Public Class Methods

new(ctx, ast_node, path) click to toggle source
# File lib/graphql/execution/interpreter/execution_errors.rb, line 7
def initialize(ctx, ast_node, path)
  @context = ctx
  @ast_node = ast_node
  @path = path
end

Public Instance Methods

add(err_or_msg) click to toggle source
# File lib/graphql/execution/interpreter/execution_errors.rb, line 13
def add(err_or_msg)
  err = case err_or_msg
  when String
    GraphQL::ExecutionError.new(err_or_msg)
  when GraphQL::ExecutionError
    err_or_msg
  else
    raise ArgumentError, "expected String or GraphQL::ExecutionError, not #{err_or_msg.class} (#{err_or_msg.inspect})"
  end
  err.ast_node ||= @ast_node
  err.path ||= @path
  @context.add_error(err)
end