Class: GraphQL::Query::Context::ExecutionErrors
- Inherits:
-
Object
- Object
- GraphQL::Query::Context::ExecutionErrors
- Defined in:
- lib/graphql/query/context.rb
Instance Method Summary collapse
- #add(err_or_msg) ⇒ Object (also: #>>, #push)
-
#initialize(ctx) ⇒ ExecutionErrors
constructor
A new instance of ExecutionErrors.
Constructor Details
#initialize(ctx) ⇒ ExecutionErrors
Returns a new instance of ExecutionErrors.
39 40 41 |
# File 'lib/graphql/query/context.rb', line 39 def initialize(ctx) @context = ctx end |
Instance Method Details
#add(err_or_msg) ⇒ Object Also known as: >>, push
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/graphql/query/context.rb', line 43 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 # This will assign ast_node and path @context.add_error(err) end |