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
DONE
public
mixed
DONE
= 0x10
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
$inspector
private
Inspector
$inspector
$jsonApi
private
bool
$jsonApi
= false
$returnFrames
private
bool
$returnFrames
= false
$run
private
RunInterface
$run
Methods
addTraceToOutput()
public
addTraceToOutput([bool|null $returnFrames = null ]) : bool|static
Parameters
- $returnFrames : bool|null = null
Return values
bool|staticcontentType()
public
contentType() : string
Return values
stringhandle()
public
handle() : int
Return values
intsetException()
public
setException(Throwable $exception) : void
Parameters
- $exception : Throwable
setInspector()
public
setInspector(Inspector $inspector) : void
Parameters
- $inspector : Inspector
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
staticsetRun()
public
setRun(RunInterface $run) : void
Parameters
- $run : RunInterface
getException()
protected
getException() : Throwable
Return values
ThrowablegetInspector()
protected
getInspector() : Inspector
Return values
InspectorgetRun()
protected
getRun() : RunInterface