rfc:retry-keyword
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:retry-keyword [2017/06/19 13:44] – More type-o's sammyk | rfc:retry-keyword [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Retry keyword in catch blocks | + | ====== PHP RFC: Retry functionality |
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2016-06-19 | * Date: 2016-06-19 | ||
Line 135: | Line 135: | ||
</ | </ | ||
- | This is arguably the cleanest option | + | While this is arguably the cleanest option, it still requires |
+ | |||
+ | <code php> | ||
+ | $maxTries = 5; | ||
+ | |||
+ | retryTheThing: | ||
+ | |||
+ | someCodeIDoNotWantToRetry(); | ||
+ | |||
+ | try { | ||
+ | somethingSketchy(); | ||
+ | } catch (RecoverableException $e) { | ||
+ | if (--$maxTries > 0) { | ||
+ | goto retryTheThing; | ||
+ | } | ||
+ | die(' | ||
+ | } | ||
+ | </ | ||
==== Use Retry ==== | ==== Use Retry ==== | ||
Line 361: | Line 378: | ||
===== Proposed PHP Version ===== | ===== Proposed PHP Version ===== | ||
- | Next PHP 7.2. | + | Next PHP 7.3. |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== |
rfc/retry-keyword.1497879890.txt.gz · Last modified: 2017/09/22 13:28 (external edit)