-
Notifications
You must be signed in to change notification settings - Fork 5
API Exceptions ClientError
General client error types for the OpenFGA SDK. Defines high-level error categories that can occur when using the SDK, providing a way to classify different types of failures such as authentication, configuration, network, serialization, and validation errors. Each case provides a factory method to create the corresponding ClientException. These error categories help applications implement appropriate error handling strategies, retry logic, and user messaging based on the type of failure: - Authentication: Token-related issues, expired credentials, OAuth failures - Configuration: Missing PSR components, invalid SDK setup, configuration errors - Network: HTTP communication failures, timeouts, API connectivity issues - Serialization: JSON parsing errors, schema validation failures, data format issues - Validation: Parameter validation failures, invalid API usage, constraint violations
Table of Contents
OpenFGA\Exceptions
UnitEnumBackedEnum
| Name | Value | Description |
|---|---|---|
Authentication |
authentication |
Authentication-related failures when communicating with OpenFGA. Includes token expiration, invalid credentials, OAuth flow failures, or other authentication mechanism issues. |
Configuration |
configuration |
SDK configuration issues that prevent proper operation. Includes missing PSR HTTP components, invalid configuration parameters, or improper SDK setup that prevents API communication. |
Network |
network |
Network and HTTP communication failures with the OpenFGA API. Includes connectivity issues, timeouts, HTTP errors, or other network-level problems that prevent successful API requests. |
Serialization |
serialization |
Data serialization and deserialization failures. Includes JSON parsing errors, schema validation failures, data type conversion issues, or other data format problems. |
Validation |
validation |
Parameter validation and API usage errors. Includes invalid parameter values, constraint violations, improper API usage, or other validation failures before sending requests. |
| Name | Value | Description |
|---|---|---|
Authentication |
authentication |
Authentication-related failures when communicating with OpenFGA. Includes token expiration, invalid credentials, OAuth flow failures, or other authentication mechanism issues. |
Configuration |
configuration |
SDK configuration issues that prevent proper operation. Includes missing PSR HTTP components, invalid configuration parameters, or improper SDK setup that prevents API communication. |
Network |
network |
Network and HTTP communication failures with the OpenFGA API. Includes connectivity issues, timeouts, HTTP errors, or other network-level problems that prevent successful API requests. |
Serialization |
serialization |
Data serialization and deserialization failures. Includes JSON parsing errors, schema validation failures, data type conversion issues, or other data format problems. |
Validation |
validation |
Parameter validation and API usage errors. Includes invalid parameter values, constraint violations, improper API usage, or other validation failures before sending requests. |
public function exception(
RequestInterface|null $request = NULL,
ResponseInterface|null $response = NULL,
array<string, mixed> $context = [],
Throwable|null $prev = NULL,
): ClientExceptionCreate a new ClientException for this error type. Factory method that creates a ClientException instance with the current error type and provided context information. This provides a convenient way to generate typed exceptions with proper error categorization and rich debugging context for OpenFGA API failures. The exception will automatically capture the correct file and line location where this method was called (typically where throw occurs), ensuring debuggers show the actual throw location rather than this factory method.
| Name | Type | Description |
|---|---|---|
$request |
RequestInterface | null
|
The PSR-7 HTTP request that triggered the exception, if applicable |
$response |
ResponseInterface | null
|
The PSR-7 HTTP response received, if applicable |
$context |
array<string, mixed>
|
|
$prev |
Throwable | null
|
The previous throwable used for exception chaining, if any |
ClientException — The newly created ClientException instance with comprehensive error context
Getting Started: Introduction • Installation • Authentication
Essentials: Stores • Authorization Models • Relationship Tuples • Permissions Queries
Features: Helper Functions • Concurrency • Results • Exceptions • Observability • Integration
- API Reference - Full class and method documentation
- Quickstart - Get up and running in minutes
- Helpers - Convenient shortcuts for common operations
- Testing Guide - Unit testing with the SDK
- Performance Guide - Optimize for high-scale applications
- Report Issues - Bug reports and feature requests
- Discussions - Community support and questions
- Contributing - Help improve the SDK
- Changelog - Latest updates and releases
- OpenFGA Documentation - Official OpenFGA documentation
- OpenFGA Playground - Interactive modeling environment
- Authorization Concepts - Learn relationship-based access control
- Other SDKs - JavaScript, Go, Python, .NET, and more
OpenFGA PHP SDK • Apache 2.0 License
- Authorization Stores
- Authorization Models
- Relationship Tuples
- Permission Queries
- Testing with Assertions
- Helper Functions
- Concurrency
- Error Handling
- Framework Integration
- OpenTelemetry Observability
- Result Pattern
- Event Dispatcher
- HTTP Request Sent Event
- HTTP Response Received Event
- Operation Started Event
- Operation Completed Event
- More Events …
- Authentication Exception
- Client Exception
- Configuration Exception
- Network Exception
- Serialization Exception
- More Exceptions …
- Request Manager
- Request Context
- Circuit Breaker
- Parallel Task Executor
- Fiber Concurrent Executor
- Simple Concurrent Executor
- Retry Handler
- Exponential Backoff Retry Strategy
- More Networking …