lib/curation_concerns/models/utils.rb in curation_concerns-models-0.1.0 vs lib/curation_concerns/models/utils.rb in curation_concerns-models-0.2.0
- old
+ new
@@ -6,17 +6,17 @@
self.class.retry_unless(number_of_tries, condition, &block)
end
module ClassMethods
def retry_unless(number_of_tries, condition, &block)
- raise ArgumentError, "First argument must be an enumerator" unless number_of_tries.is_a? Enumerator
- raise ArgumentError, "Second argument must be a lambda" unless condition.respond_to? :call
- raise ArgumentError, "Must pass a block of code to retry" unless block_given?
+ fail ArgumentError, 'First argument must be an enumerator' unless number_of_tries.is_a? Enumerator
+ fail ArgumentError, 'Second argument must be a lambda' unless condition.respond_to? :call
+ fail ArgumentError, 'Must pass a block of code to retry' unless block_given?
number_of_tries.each do
result = block.call
return result unless condition.call
end
- raise RuntimeError, "retry_unless could not complete successfully. Try upping the # of tries?"
+ fail 'retry_unless could not complete successfully. Try upping the # of tries?'
end
end
end
end