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
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.
My error message is this
#
That’s way too long. Rubo has a fit with it.
‘#’
I can’t get it to post like it is.
err = ‘#’
‘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.’
I made it into a string once and then put it to the expected array like so
“[#{err}, #{err}, #{err}]”