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)


79
80
81
82
83
84
85
86
# File 'lib/dry/types/errors.rb', line 79

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)


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

def key
  @key
end

#valueObject (readonly)

Returns:

  • (Object)


74
75
76
# File 'lib/dry/types/errors.rb', line 74

def value
  @value
end