Exception: GraphQL::Query::VariableValidationError

Inherits:
ExecutionError show all
Defined in:
lib/graphql/query/variable_validation_error.rb

Instance Attribute Summary collapse

Attributes inherited from ExecutionError

#ast_node, #extensions, #options, #path

Instance Method Summary collapse

Constructor Details

#initialize(variable_ast, type, value, validation_result) ⇒ VariableValidationError

Returns a new instance of VariableValidationError.



7
8
9
10
11
12
13
14
# File 'lib/graphql/query/variable_validation_error.rb', line 7

def initialize(variable_ast, type, value, validation_result)
  @value = value
  @validation_result = validation_result

  msg = "Variable #{variable_ast.name} of type #{type} was provided invalid value"
  super(msg)
  self.ast_node = variable_ast
end

Instance Attribute Details

#validation_resultObject

Returns the value of attribute validation_result.



5
6
7
# File 'lib/graphql/query/variable_validation_error.rb', line 5

def validation_result
  @validation_result
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/graphql/query/variable_validation_error.rb', line 5

def value
  @value
end

Instance Method Details

#to_hObject



16
17
18
# File 'lib/graphql/query/variable_validation_error.rb', line 16

def to_h
  super.merge({ "value" => value, "problems" => validation_result.problems })
end