Created
May 8, 2019 10:35
-
-
Save JonZso/a574e328a9b87af1861308c0a8321373 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
retries ||= 0 | |
puts "trying to check if file exists.." | |
sleep(4) | |
file = File.read("file2.json") | |
raise "Files doesn't exist" | |
rescue | |
retry if (retries += 1) < 3 and !File.file?("file2.json") | |
if retries == 3 | |
file = "File Not Found." | |
end | |
end | |
puts file | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment