Using the Retry Method inside of a Ruby Rescue Block

6
1274

In this coding exercise you’ll learn how to automatically retry a failed process in a Ruby program.

Summary

Implement a system that automatically retries a failed API call for a pre-determined number of times.

Exercise File

Code File

Exercise Description

Build out the ability for a Ruby method that calls a failing API to retry 3 times, along with storing the error messages in an array.

Real World Usage

Whenever you work with an API it’s important to assume that there will be times when the API is down. In this coding exercise you’ll learn how to automatically retry an API call after it has failed.

Solution

Can be found on the solutions branch on github.

6 COMMENTS

  1. ‘A connection attempt failed because the’ \
    ‘ connected party did not properly respond after a period of time,’ \
    ‘ or established connection failed because connected host’ \
    ‘ has failed to respond.’

LEAVE A REPLY

Please enter your comment!
Please enter your name here