ErrorControlChain
class ErrorControlChain (View source)
Class ErrorControlChain
Runs a set of steps, optionally suppressing uncaught errors or exceptions which would otherwise be fatal that occur in each step. If an error does occur, subsequent steps are normally skipped, but can optionally be run anyway.
Usage:
$chain = new ErrorControlChain(); $chain->then($callback1)->then($callback2)->thenIfErrored($callback3)->execute();
WARNING: This class is experimental and designed specifically for use pre-startup in main.php It will likely be heavily refactored before the release of 3.2
Properties
static | $fatal_errors | ||
static | $transtable |
Methods
Determine if an error has been found
No description
Sets whether errors are suppressed or not Notes:
- Errors cannot be suppressed if not handling errors.
Add this callback to the chain of callbacks to call along with the state that $error must be in this point in the chain for the callback to be called
Request that the callback is invoked if not errored
Request that the callback is invoked on error
Request that the callback is invoked always
No description
No description
Details
bool
hasErrored()
Determine if an error has been found
setErrored($error)
setSuppression(bool $suppression)
Sets whether errors are suppressed or not Notes:
- Errors cannot be suppressed if not handling errors.
- Errors cannot be un-suppressed if original mode dis-allowed visible errors
$this
then($callback, $onErrorState = false)
Add this callback to the chain of callbacks to call along with the state that $error must be in this point in the chain for the callback to be called
$this
thenWhileGood(callable $callback)
Request that the callback is invoked if not errored
$this
thenIfErrored(callable $callback)
Request that the callback is invoked on error
$this
thenAlways(callable $callback)
Request that the callback is invoked always