lib/atacama/contract/validator.rb in atacama-0.1.7 vs lib/atacama/contract/validator.rb in atacama-0.1.8
- old
+ new
@@ -23,12 +23,10 @@
attr_reader :options, :context, :klass
def detect_invalid_types!
options.each do |key, parameter|
- begin
- parameter.validate! context[key]
- rescue Dry::Types::ConstraintError => e
+ Atacama.check(parameter.type, context[key]) do |e|
raise OptionTypeMismatchError, %(#{klass} option :#{key} invalid: #{e.message})
end
end
end
end