API Documentation (v0.9.0-alpha)

Avolutions\Core\ErrorHandler

The ErrorHandler class handles uncaught errors and exceptions.

Methods

Method Visibility Description
__construct() public Creates a new ErrorHandler instance.
handleError() public Handles uncaught errors, convert them into an exception and throw it.
handleException() public Handles uncaught exceptions and log them with LogLevel 'ERROR'.

Method Details

__construct()

Creates a new ErrorHandler instance.

public __construct(Logger $Logger) : mixed
Parameters

Logger $Logger
Logger instance

handleError()

Handles uncaught errors, convert them into an exception and throw it.

public handleError(int $code, string $message[, string|null $file = null ][, int|null $line = null ]) : mixed
Parameters

int $code
The level of the error.

string $message
The error message.

string|null $file (optional)
The filename the error was raised in.

int|null $line (optional)
The line number the error was raised at.

Return values
mixed Handles uncaught errors, convert them into an exception and throw it.
handleException()

Handles uncaught exceptions and log them with LogLevel 'ERROR'.

public handleException(Throwable $exception) : mixed
Parameters

Throwable $exception
The exception to handle.

Return values
mixed Handles uncaught exceptions and log them with LogLevel 'ERROR'.