Retry pseudo-code
function retry(retries = 1)
while true
try
result = do_something()
return result
catch SomeException e
if retries > 0 then
retries = retries - 1
log_or_some_recovery()
else
throw e
end
end
end
end
