Retry On Raised Exceptions in Ruby
You can use the retry keyword to re-attempt code execution after an error is raised. A very primitive example would be -
def do_something
Service.call # might raise an error
rescue
retry
end
retry will call the code above the rescue again. The caveat, here, is that the above code will trigger an infinite loop, so you must handle this explicitly.