ApiExceptionRenderer
extends WebExceptionRenderer
in package
Returns JSON error responses for API routes instead of HTML error pages.
Routes starting with /api/ receive a JSON envelope matching ApiController's apiError() format. All other routes fall through to the default HTML renderer.
Table of Contents
Properties
- $exceptionHttpCodes : array<string|int, mixed>
Methods
- render() : ResponseInterface
- Render the error response.
- isApiRequest() : bool
- Check if api request.
- renderApiJson() : ResponseInterface
- Render api json.
Properties
$exceptionHttpCodes
protected
array<string|int, mixed>
$exceptionHttpCodes
= [\Authorization\Exception\ForbiddenException::class => 403, \Authorization\Exception\MissingIdentityException::class => 401]
Methods
render()
Render the error response.
public
render() : ResponseInterface
Return values
ResponseInterfaceisApiRequest()
Check if api request.
protected
isApiRequest() : bool
Return values
boolrenderApiJson()
Render api json.
protected
renderApiJson() : ResponseInterface