Exception: ZeroRuby::CoercionError

Inherits:
Error
  • Object
show all
Defined in:
lib/zero_ruby/errors.rb

Overview

Raised when a value cannot be coerced to the expected type

Instance Attribute Summary collapse

Attributes inherited from Error

#details

Instance Method Summary collapse

Methods inherited from Error

#error_type

Constructor Details

#initialize(message, value: nil, expected_type: nil) ⇒ CoercionError

Returns a new instance of CoercionError.



31
32
33
34
35
# File 'lib/zero_ruby/errors.rb', line 31

def initialize(message, value: nil, expected_type: nil)
  @value = value
  @expected_type = expected_type
  super(message)
end

Instance Attribute Details

#expected_typeObject (readonly)

Returns the value of attribute expected_type.



29
30
31
# File 'lib/zero_ruby/errors.rb', line 29

def expected_type
  @expected_type
end

#valueObject (readonly)

Returns the value of attribute value.



29
30
31
# File 'lib/zero_ruby/errors.rb', line 29

def value
  @value
end