Exception: Dry::Types::SchemaError

Inherits:
CoercionError show all
Defined in:
lib/dry/types/errors.rb

Instance Attribute Summary collapse

Attributes inherited from CoercionError

#meta

Instance Method Summary collapse

Methods inherited from CoercionError

handle

Constructor Details

#initialize(key, value, result) ⇒ SchemaError

Returns a new instance of SchemaError.

Parameters:

  • key (String, Symbol)
  • value (Object)
  • result (String, #to_s)

75
76
77
78
79
80
81
82
# File 'lib/dry/types/errors.rb', line 75

def initialize(key, value, result)
  @key = key
  @value = value
  super(
    "#{value.inspect} (#{value.class}) has invalid type " \
    "for :#{key} violates constraints (#{result} failed)"
  )
end

Instance Attribute Details

#keyString, Symbol (readonly)

Returns:

  • (String, Symbol)

67
68
69
# File 'lib/dry/types/errors.rb', line 67

def key
  @key
end

#valueObject (readonly)

Returns:

  • (Object)

70
71
72
# File 'lib/dry/types/errors.rb', line 70

def value
  @value
end