Exception: GraphWeaver::ValidationError

Inherits:
Error
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/graph_weaver/errors.rb

Overview

Build-time: the query didn't validate against the schema. Carries the structured validation errors (message + line/column) rather than a joined string. Under the Error umbrella like everything else raised here (through 0.1.0 it was an ArgumentError instead).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ValidationError

Returns a new instance of ValidationError.



438
439
440
441
# File 'lib/graph_weaver/errors.rb', line 438

def initialize(errors)
  @errors = errors
  super("invalid query: #{errors.map { |e| e[:message] }.join("; ")}")
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



435
436
437
# File 'lib/graph_weaver/errors.rb', line 435

def errors
  @errors
end

Instance Method Details

#to_hObject



444
445
446
# File 'lib/graph_weaver/errors.rb', line 444

def to_h
  super.merge("errors" => errors.map { |e| e.transform_keys(&:to_s) })
end