Documentation Index
Fetch the complete documentation index at: https://mintlify.com/reductoai/reducto-python-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Reducto Python SDK provides a comprehensive exception hierarchy to help you handle different types of errors that may occur when interacting with the API.Exception Hierarchy
All errors inherit fromreducto.APIError, which itself inherits from reducto.ReductoError:
Basic Error Handling
When the API returns a non-success status code (4xx or 5xx), a subclass ofreducto.APIStatusError is raised with status_code and response properties:
Exception Types
Connection Errors
Raised when the library is unable to connect to the API (e.g., due to network connection problems).Attributes:
message- Error messagerequest- The HTTP request object__cause__- The underlying exception, likely from httpx
Raised when a request times out. Inherits from
APIConnectionError.Note: Requests that time out are retried twice by default.Status Code Errors
Base class for all HTTP status code errors (4xx and 5xx responses).Attributes:
status_code- The HTTP status coderesponse- The HTTP response objectmessage- Error messagerequest- The HTTP request objectbody- The response body (decoded JSON or raw response)
HTTP Status Code Reference
| Status Code | Error Type | Description |
|---|---|---|
| 400 | BadRequestError | Invalid request parameters |
| 401 | AuthenticationError | Invalid or missing API key |
| 403 | PermissionDeniedError | Insufficient permissions |
| 404 | NotFoundError | Resource not found |
| 409 | ConflictError | Request conflicts with current state |
| 422 | UnprocessableEntityError | Valid request but unable to process |
| 429 | RateLimitError | Rate limit exceeded |
| >=500 | InternalServerError | Server-side error |
| N/A | APIConnectionError | Network connectivity issues |
Common Error Scenarios
Authentication Errors
Rate Limiting
Connection Errors
Validation Errors
Automatic Retries
Certain errors are automatically retried 2 times by default with exponential backoff:- Connection errors (network connectivity issues)
- 408 Request Timeout
- 409 Conflict
- 429 Rate Limit
-
=500 Internal Server errors
Retries can be configured using the
max_retries option when initializing the client or per-request using with_options().Accessing Error Details
AllAPIStatusError exceptions provide access to detailed error information:
Best Practices
Catch Specific Exceptions
Always catch specific exception types before generic ones to handle different error scenarios appropriately.
Log Error Details
Log the
status_code, message, and body attributes for debugging and monitoring.Implement Retry Logic
For transient errors like rate limits or timeouts, implement appropriate retry logic with exponential backoff.
Handle Connection Errors
Always handle
APIConnectionError to gracefully manage network issues.