API Exceptions SerializationException - evansims/openfga-php GitHub Wiki
Serialization-related exception for the OpenFGA SDK. Thrown when data serialization, deserialization, or validation errors occur while processing API requests and responses. This includes JSON parsing failures, schema validation errors, and data type conversion issues. Provides detailed context about the serialization failure.
Table of Contents
OpenFGA\Exceptions
Stringable
Throwable
ClientThrowable
public function context(): array<string, mixed>
Get additional context information about the exception. Provides access to contextual data that was available when the exception occurred, such as parameter values, configuration details, API response data, or other relevant debugging information. This context is essential for understanding the circumstances that led to the error and can be used for logging, debugging, and error reporting.
array<
string,
mixed>
— Associative array of context data including parameter values, error details, and debugging information
public function getCode()
public function getFile(): string
string
public function getLine(): int
int
public function getMessage(): string
string
public function getPrevious(): ?Throwable
Throwable
| null
public function getTrace(): array
array
public function getTraceAsString(): string
string
public function kind(): OpenFGA\Exceptions\ClientError|OpenFGA\Exceptions\AuthenticationError|OpenFGA\Exceptions\ConfigurationError|OpenFGA\Exceptions\NetworkError|OpenFGA\Exceptions\SerializationError
Get the specific error category for this exception. Returns the error classification that indicates the general category of the problem (authentication, configuration, network, etc.), allowing for categorized error handling and reporting. This categorization helps applications implement appropriate retry logic, user messaging, and error recovery strategies based on the type of failure.
ClientError
| AuthenticationError
| ConfigurationError
| NetworkError
| SerializationError
— The error category enum indicating the type of failure
public function previous(): ?Throwable
Get the previous exception that caused this one. Provides access to the exception chain for cases where this exception was triggered by another underlying exception. This maintains the full context of error propagation and is essential for root cause analysis when exceptions are wrapped or transformed during processing.
Throwable
| null
— The previous exception in the chain, or null if this is the root exception
public function request(): ?Psr\Http\Message\RequestInterface
Get the HTTP request associated with this exception. Returns the PSR-7 HTTP request that was being processed when this exception occurred. This is particularly useful for debugging API call failures, allowing developers to inspect the request URL, headers, body, and method that led to the error condition.
Psr\Http\Message\RequestInterface
| null
— The PSR-7 HTTP request that triggered the exception, or null if not applicable
public function response(): ?Psr\Http\Message\ResponseInterface
Get the HTTP response associated with this exception. Returns the PSR-7 HTTP response that was received when this exception occurred, providing access to status codes, headers, and response body for debugging. This is especially valuable for understanding API-level failures and can contain detailed error messages from the OpenFGA service.
Psr\Http\Message\ResponseInterface
| null
— The PSR-7 HTTP response received from the API, or null if no response was received