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.



114
115
116
117
118
119
120
121
# File 'lib/odin/types/errors.rb', line 114

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.



112
113
114
# File 'lib/odin/types/errors.rb', line 112

def actual
  @actual
end

#codeObject (readonly)

Returns the value of attribute code.



112
113
114
# File 'lib/odin/types/errors.rb', line 112

def code
  @code
end

#expectedObject (readonly)

Returns the value of attribute expected.



112
113
114
# File 'lib/odin/types/errors.rb', line 112

def expected
  @expected
end

#messageObject (readonly)

Returns the value of attribute message.



112
113
114
# File 'lib/odin/types/errors.rb', line 112

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path.



112
113
114
# File 'lib/odin/types/errors.rb', line 112

def path
  @path
end

#schema_pathObject (readonly)

Returns the value of attribute schema_path.



112
113
114
# File 'lib/odin/types/errors.rb', line 112

def schema_path
  @schema_path
end

Instance Method Details

#to_sObject



123
124
125
# File 'lib/odin/types/errors.rb', line 123

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