Error Handling
The SDK provides typed exceptions for different error scenarios.
Exception Hierarchy
Section titled “Exception Hierarchy”QualiaError└── QualiaAPIError ├── AuthenticationError ├── NotFoundError ├── ValidationError └── RateLimitErrorfrom qualia import ( Qualia, QualiaError, QualiaAPIError, AuthenticationError, NotFoundError, ValidationError, RateLimitError,)
try: client = Qualia(api_key="invalid-key") client.models.list()except AuthenticationError as e: print(f"Auth failed: {e}")except NotFoundError as e: print(f"Not found: {e}")except ValidationError as e: print(f"Validation error: {e}")except RateLimitError as e: print(f"Rate limited. Retry after: {e.retry_after}s")except QualiaAPIError as e: print(f"API error [{e.status_code}]: {e.message}")except QualiaError as e: print(f"SDK error: {e}")Exception Details
Section titled “Exception Details”| Exception | Description |
|---|---|
QualiaError | Base exception for all SDK errors |
QualiaAPIError | API returned an error response |
AuthenticationError | Invalid or missing API key |
NotFoundError | Requested resource doesn’t exist |
ValidationError | Invalid request parameters |
RateLimitError | Too many requests, includes retry_after |