Class: GraphQL::Execution::Interpreter::ExecutionErrors
- Inherits:
-
Object
- Object
- GraphQL::Execution::Interpreter::ExecutionErrors
- Defined in:
- lib/graphql/execution/interpreter/execution_errors.rb
Instance Method Summary collapse
-
#add(err_or_msg) ⇒ Object
-
#initialize(ctx, ast_node, path) ⇒ ExecutionErrors
constructor
A new instance of ExecutionErrors.
Constructor Details
#initialize(ctx, ast_node, path) ⇒ ExecutionErrors
Returns a new instance of ExecutionErrors.
7 8 9 10 11 |
# 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 |
Instance Method Details
#add(err_or_msg) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |