Exception Hierarchy
All SDK exceptions extend fromXpozError. Import them from the package:
The Python SDK includes two additional exception types not present in the TypeScript SDK:
NotFoundError and ValidationError. These provide more granular error handling for common input issues.Catching Exceptions
Useexcept clauses to handle specific exception types. Always catch more specific exceptions before the base XpozError:
- Sync
- Async
Exception Details
AuthenticationError
Raised when the access key is invalid, expired, or missing.OperationTimeoutError
Raised when an operation exceeds the configured timeout (default: 300 seconds). The exception includes the elapsed time.OperationFailedError
Raised when an operation completes but with an error status. Includes theoperation_id and error details.
OperationCancelledError
Raised when an operation is cancelled, typically due to server-side resource management.NotFoundError
Raised when a requested resource (user, post, subreddit) does not exist.ValidationError
Raised when invalid parameters are passed to a method.Practical Pattern
A robust wrapper that handles all error cases:- Sync
- Async
For the equivalent error handling patterns in TypeScript, see TypeScript SDK Error Handling. The TypeScript SDK uses
try/catch with instanceof checks instead of try/except.
