Leaf PHP

JsonResponseHandler extends Handler
in package

Catches an exception and converts it to a JSON response. Additionally can also return exception frames for consumption by an API.

Table of Contents

Constants

DONE  = 0x10
LAST_HANDLER  = 0x20
The Handler has handled the Throwable in some way, and wishes to skip any other Handler.
QUIT  = 0x30
The Handler has handled the Throwable in some way, and wishes to quit/stop execution

Properties

$exception  : Throwable
$inspector  : Inspector
$jsonApi  : bool
$returnFrames  : bool
$run  : RunInterface

Methods

addTraceToOutput()  : bool|static
contentType()  : string
handle()  : int
setException()  : void
setInspector()  : void
setJsonApi()  : static
Returns errors[[]] instead of error[] to be in compliance with the json:api spec
setRun()  : void
getException()  : Throwable
getInspector()  : Inspector
getRun()  : RunInterface

Constants

LAST_HANDLER

The Handler has handled the Throwable in some way, and wishes to skip any other Handler.

public mixed LAST_HANDLER = 0x20

Execution will continue.

QUIT

The Handler has handled the Throwable in some way, and wishes to quit/stop execution

public mixed QUIT = 0x30

Properties

$exception

private Throwable $exception

Methods

addTraceToOutput()

public addTraceToOutput([bool|null $returnFrames = null ]) : bool|static
Parameters
$returnFrames : bool|null = null
Return values
bool|static

setException()

public setException(Throwable $exception) : void
Parameters
$exception : Throwable

setJsonApi()

Returns errors[[]] instead of error[] to be in compliance with the json:api spec

public setJsonApi([bool $jsonApi = false ]) : static
Parameters
$jsonApi : bool = false

Default is false

Return values
static

getException()

protected getException() : Throwable
Return values
Throwable

        
On this page

Search results