Created
April 10, 2017 19:49
-
-
Save rawkode/a199f189e865e3a3f98af7051b15492b to your computer and use it in GitHub Desktop.
PHP Retry
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
<?php | |
try { | |
// code ... | |
} catch(SomeException $eex) { | |
// Fatal exception, no retry | |
$logger->debug("blah"); | |
break; | |
} catch(AnotherException $aex) { | |
// log exception and retry | |
$logger->debug("blah"); | |
retry; | |
} retry(int $attempt) { | |
// code to run before executing try{} again | |
// can exit if $attempt > your limit | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment