lib/lev/errors.rb in lev-2.2.2 vs lib/lev/errors.rb in lev-3.0.0
- old
+ new
@@ -29,9 +29,20 @@
# Checks to see if the provided input is associated with one of the errors.
def has_offending_input?(input)
self.any? {|error| [error.offending_inputs].flatten.include? input}
end
+ def raise_exception_if_any!(exception_type = StandardError)
+ raise exception_type, collect{|error| error.message}.join('; ') if any?
+ end
+
+ def reraise_exception!
+ exception_error = select{|error| error.kind == :exception}.first
+ return if exception_error.nil?
+ raise exception_error.data
+ end
+
+
protected
def ignored_error_procs
@ignored_error_procs ||= []
end
\ No newline at end of file