Exception: GraphWeaver::ValidationError

Inherits:
Error
  • Object
show all
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.



313
314
315
316
# File 'lib/graph_weaver/errors.rb', line 313

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.



311
312
313
# File 'lib/graph_weaver/errors.rb', line 311

def errors
  @errors
end

Instance Method Details

#to_hObject



318
319
320
# File 'lib/graph_weaver/errors.rb', line 318

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