Class: Odin::Errors::ValidationError

Inherits:
Object
  • Object
show all
Defined in:
lib/odin/types/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ValidationError.



106
107
108
109
110
111
112
113
# File 'lib/odin/types/errors.rb', line 106

def initialize(code:, path:, message:, expected: nil, actual: nil, schema_path: nil)
  @code = code
  @path = path
  @message = message
  @expected = expected
  @actual = actual
  @schema_path = schema_path
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



104
105
106
# File 'lib/odin/types/errors.rb', line 104

def actual
  @actual
end

#codeObject (readonly)

Returns the value of attribute code.



104
105
106
# File 'lib/odin/types/errors.rb', line 104

def code
  @code
end

#expectedObject (readonly)

Returns the value of attribute expected.



104
105
106
# File 'lib/odin/types/errors.rb', line 104

def expected
  @expected
end

#messageObject (readonly)

Returns the value of attribute message.



104
105
106
# File 'lib/odin/types/errors.rb', line 104

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path.



104
105
106
# File 'lib/odin/types/errors.rb', line 104

def path
  @path
end

#schema_pathObject (readonly)

Returns the value of attribute schema_path.



104
105
106
# File 'lib/odin/types/errors.rb', line 104

def schema_path
  @schema_path
end

Instance Method Details

#to_sObject



115
116
117
# File 'lib/odin/types/errors.rb', line 115

def to_s
  "[#{code}] #{message} at '#{path}'"
end