0.0
No commit activity in last 3 years
No release in over 3 years
Especially useful for handling cross network calls.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
>= 0
 Project Readme

Gem Version Build Status

RetryOnError

A simple utility for configuring retry behavior based on errors.

gem 'retry_on_error'

Usage

flaky_call = -> { Intercom::Client.new(...).users.create(params) }

# basic usage
# +max_wait: the maximum number of seconds the retries are allowed to take
# +delay: wait time (slee) between retries
RetryOnError.call(
  Intercom::ServerError,
  max_wait: 1,
  delay: 1
) do
  flaky_call.call()
end

# only retry errors with matching messages
RetryOnError.call(
  [ Intercom::ServerError, /error message regex/ ],
  max_wait: 1
) do
  flaky_call.call()
end

# retry on a variety of matching errors
RetryOnError.call(
  Intercom::ServiceUnavailableError,
  [ Intercom::ServerError, /error message regex/ ],
  max_wait: 1
) do
  flaky_call.call()
end

Local development

$ bundle install
$ bundle exec rspec spec

Contributions

Contributions welcomed! Please link an issue in every pull request, and please include tests.