module Mailgun::RetryHelper

Public Class Methods

with_rescue(exception, limit=1, &block) click to toggle source
# File lib/mailgun/mailbox/with_rescue.rb, line 3
def self.with_rescue(exception, limit=1, &block)

  try=0
  begin
    block.call(try)
  rescue exception
    try+=1
    retry if try<=limit
  end
end
with_rescue_many(exceptions, limit=1, &block) click to toggle source
# File lib/mailgun/mailbox/with_rescue.rb, line 14
def self.with_rescue_many(exceptions, limit=1, &block)

  try=0
  begin
    block.call(try)
  rescue *exceptions
    try+=1
    retry if try<=limit
  end
end