UserFrosting API

ExceptionHandlerManager

Default UserFrosting application error handler.

It outputs the error message and diagnostic information in either JSON, XML, or HTML based on the Accept header.

Tags
author

Alex Weissman (https://alexanderweissman.com)

Table of Contents

$ci ContainerInterface
$exceptionHandlers
$displayErrorDetails bool
__construct() Constructor. mixed
__invoke() Invoke error handler. ResponseInterface
registerHandler() Register an exception handler for a specified exception class. mixed

Properties

Methods

__construct()

Constructor.

public __construct( $ci : ContainerInterface [, $displayErrorDetails : bool = false ] ) : mixed
Parameters
$ci : ContainerInterface

The global container object, which holds all your services.

$displayErrorDetails : bool = false

Set to true to display full details

Return values
mixed

__invoke()

Invoke error handler.

public __invoke( $request : ServerRequestInterface , $response : ResponseInterface , $exception : Throwable ) : ResponseInterface
Parameters
$request : ServerRequestInterface

The most recent Request object

$response : ResponseInterface

The most recent Response object

$exception : Throwable

The caught Exception object

Return values
ResponseInterface

registerHandler()

Register an exception handler for a specified exception class.

public registerHandler( $exceptionClass : string , $handlerClass : string ) : mixed

The exception handler must implement \UserFrosting\Sprinkle\Core\Handler\ExceptionHandlerInterface.

Parameters
$exceptionClass : string

The fully qualified class name of the exception to handle.

$handlerClass : string

The fully qualified class name of the assigned handler.

Tags
throws
InvalidArgumentException

If the registered handler fails to implement ExceptionHandlerInterface

Return values
mixed

Search results