lib/atacama/contract.rb in atacama-0.1.9 vs lib/atacama/contract.rb in atacama-0.1.10
- old
+ new
@@ -89,10 +89,12 @@
# @raise [Dry::Types::ConstraintError] a type check failure
#
# @param value [Any] the object to type check
def validate_return(value)
Atacama.check(return_type, value) do |e|
- raise ReturnTypeMismatchError, "#{self} return value invalid: #{e.message}"
+ raise ReturnTypeMismatchError, Atacama.format_exception(self, e,
+ 'The return value was an incorrect type.',
+ )
end
end
# The defined options on the contract.
#