Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created December 12, 2012 14:00
Show Gist options
  • Save kyanny/4267917 to your computer and use it in GitHub Desktop.
Save kyanny/4267917 to your computer and use it in GitHub Desktop.
require 'bundler/setup'
require 'retry-handler'
begin
Proc.new { |cnt|
warn "failed ##{cnt}"
raise StandardError
}.retry(accept_exception: StandardError)
rescue => e
p e
end
class Foo
def retry_foo()
warn "failed"
raise StandardError
end
def retry_bar(cnt)
warn "failed ##{cnt}"
raise StandardError
end
end
begin
Foo.new.method(:retry_foo).retry(accept_exception: StandardError)
rescue => e
p e
end
begin
Foo.new.method(:retry_bar).retry(accept_exception: StandardError)
rescue => e
p e
end
begin
retry_handler(accept_exception: StandardError) do |cnt|
warn "failed ##{cnt}"
raise StandardError
end
rescue => e
p e
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment