lib/ensure_it/errors.rb in ensure_it-0.1.3 vs lib/ensure_it/errors.rb in ensure_it-0.1.4
- old
+ new
@@ -57,11 +57,11 @@
.gsub(/\#\{name\}/, @subject.to_s)
.gsub(/\#\{method_name\}/, @method_name.to_s)
end
end
- def self.raise_error(method_name, message: nil, error: Error, **opts)
- error = Error unless error <= Exception
+ def self.raise_error(method_name, message: nil, error: nil, **opts)
+ error = EnsureIt.config.error_class if error.nil? || !(error <= Exception)
error_msg = ErrorMessage.new(method_name, message, caller[1..-1])
# save message in backtrace in variables to not call getter
# methods of error_msg instance in raise call
error_message = error_msg.message
error_backtrace = error_msg.backtrace