Permalink
Switch branches/tags
Find file Copy path
6c85162 Sep 19, 2014
1 contributor

Users who have contributed to this file

20 lines (16 sloc) 341 Bytes
<?php
namespace igorw;
class FailingTooHardException extends \Exception {}
function retry($retries, callable $fn)
{
beginning:
try {
return $fn();
} catch (\Exception $e) {
if (!$retries) {
throw new FailingTooHardException('', 0, $e);
}
$retries--;
goto beginning;
}
}