UnauthorizedException
extends ApiException
in package
Thrown to deny access with a 401 Unauthorized status.
Use when authentication is required but missing, or when an authorize()
method needs to deny access without distinguishing further. For credentials
that are present but rejected, prefer {@see}; for
"authenticated but not allowed", prefer {@see}.
Wire shape: extensions.code = 'UNAUTHORIZED', HTTP status 401.
Table of Contents
- __construct() : mixed
- Constructor.
- getErrorCode() : string
- Get the machine-readable error code.
- getExtensions() : array<string|int, mixed>
- Get the additional error metadata.
- getStatusCode() : int
- Get the HTTP status code.
Methods
__construct()
Constructor.
public
__construct([string $message = 'Authentication required.' ][, array<string|int, mixed> $extensions = array() ][, Throwable|null $previous = null ]) : mixed
Parameters
- $message : string = 'Authentication required.'
-
The error message.
- $extensions : array<string|int, mixed> = array()
-
Additional error metadata to surface in the GraphQL
extensionsobject. - $previous : Throwable|null = null
-
The previous throwable for chaining.
Return values
mixed —getErrorCode()
Get the machine-readable error code.
public
getErrorCode() : string
Return values
string —getExtensions()
Get the additional error metadata.
public
getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getStatusCode()
Get the HTTP status code.
public
getStatusCode() : int
