lib/rasti/form/errors.rb in rasti-form-1.1.1 vs lib/rasti/form/errors.rb in rasti-form-2.0.0
- old
+ new
@@ -21,9 +21,29 @@
end
end
+ class MultiCastError < StandardError
+
+ attr_reader :type, :value, :errors
+
+ def initialize(type, value, errors)
+ @type = type
+ @value = value
+ @errors = errors
+ end
+
+ def message
+ "Invalid cast: #{display_value} -> #{type} - #{JSON.dump(errors)}"
+ end
+
+ def display_value
+ value.is_a?(::String) ? "'#{value}'" : value.inspect
+ end
+
+ end
+
class ValidationError < StandardError
attr_reader :scope, :errors
def initialize(scope, errors)
\ No newline at end of file