Exception: Ibex::Runtime::CST::ValidationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ibex/runtime/cst/validator.rb,
sig/ibex/runtime/cst/validator.rbs

Overview

Structured failure raised for an invalid or incompatible CST document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, path:, message:, expected: nil, actual: nil) ⇒ ValidationError

Returns a new instance of ValidationError.

RBS:

  • (code: Symbol, path: String, message: String, ?expected: json_value, ?actual: json_value) -> void

Parameters:

  • code: (Symbol)
  • path: (String)
  • message: (String)
  • expected: (json_value) (defaults to: nil)
  • actual: (json_value) (defaults to: nil)


21
22
23
24
25
26
27
# File 'lib/ibex/runtime/cst/validator.rb', line 21

def initialize(code:, path:, message:, expected: nil, actual: nil)
  @code = code
  @path = path.dup.freeze
  @expected = expected
  @actual = actual
  super("(cst):#{path}: #{message}")
end

Instance Attribute Details

#actualjson_value (readonly)

Signature:

  • json_value

Returns:

  • (json_value)


18
19
20
# File 'lib/ibex/runtime/cst/validator.rb', line 18

def actual
  @actual
end

#codeSymbol (readonly)

Signature:

  • Symbol

Returns:

  • (Symbol)


15
16
17
# File 'lib/ibex/runtime/cst/validator.rb', line 15

def code
  @code
end

#expectedjson_value (readonly)

Signature:

  • json_value

Returns:

  • (json_value)


17
18
19
# File 'lib/ibex/runtime/cst/validator.rb', line 17

def expected
  @expected
end

#pathString (readonly)

Signature:

  • String

Returns:

  • (String)


16
17
18
# File 'lib/ibex/runtime/cst/validator.rb', line 16

def path
  @path
end