Documentation

ErrorHandler

ErrorHandler utility class.

Allows catching and resolving errors inline.

Table of Contents

Methods

restore()  : bool
Remove error handler.
set()  : mixed
Set error handler to run until removed.
with()  : mixed
Run code with error handling, breaks on first encountered error.
withAll()  : mixed
Run code with error handling, comletes code before handling errors
getHandler()  : mixed
handle()  : mixed

Methods

restore()

Remove error handler.

public restore() : bool
Return values
bool

True if removed

set()

Set error handler to run until removed.

public set([mixed $handling = null ][, int $levels = E_ALL ]) : mixed
Parameters
$handling : mixed = null
$levels : int = E_ALL

Error levels to catch, all errors by default

Return values
mixed

Previously registered error handler, if any

with()

Run code with error handling, breaks on first encountered error.

public with(callable $callback[, mixed $handling = null ][, int $levels = E_ALL ]) : mixed
Parameters
$callback : callable

The code to run

$handling : mixed = null
$levels : int = E_ALL

Error levels to catch, all errors by default

Return values
mixed

Return what $callback returns, or what $handling retuns on error

withAll()

Run code with error handling, comletes code before handling errors

public withAll(callable $callback[, mixed $handling = null ][, int $levels = E_ALL ]) : mixed
Parameters
$callback : callable

The code to run

$handling : mixed = null
$levels : int = E_ALL

Error levels to catch, all errors by default

Return values
mixed

Return what $callback returns, or what $handling retuns on error

getHandler()

private getHandler(mixed $handling) : mixed
Parameters
$handling : mixed

handle()

private handle(mixed $handling, mixed $error[, mixed $result = null ]) : mixed
Parameters
$handling : mixed
$error : mixed
$result : mixed = null

        
On this page

Search results