Skip to content

Instantly share code, notes, and snippets.

View joaovictor-local's full-sized avatar
🎯
Focusing

joaovictor.local joaovictor-local

🎯
Focusing
View GitHub Profile
@joaovictor-local
joaovictor-local / error_handler.rb
Created May 5, 2022 14:07
retry on known error # ruby
module Error
module ErrorHandler
def retry_on_known_error(retry_limit:, known_errors: [], &block)
retry_count = 0
block.call
rescue *known_errors => e
raise e if retry_count == retry_limit
retry_count += 1
require:
- rubocop-rails
- rubocop-rspec
AllCops:
Exclude:
- 'db/**/*'
- 'tmp/**/*'
- 'vendor/**/*'
- 'bin/**/*'