Project

retrier

0.0
No commit activity in last 3 years
No release in over 3 years
Retries a code block the given number of times
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
 Project Readme

#Retrier

Retry a code block the given number of times.

##Usage

###Basic usage

Retrier.new(max_tries: 5) do
  do_something_which_may_fail
end

###Specify which exceptions to catch

Retrier.new(max_tries: 3, rescue: [MyCustomException, OtherException]) do
...
end

###Exception handlers If supplied with a list of handler functions, Retrier will call the handler method. If there isn't a registered handler for the raised exception it will retry the block.

handlers = {
  StandardError: (exception) -> {
    do_something_if_standard_error_has_beenraised
  }
}

Retrier.new(handlers: handlers) do
  risky_operation
end