Error Handling
Handle errors and implement retry logic
Error Handling
The SDK provides error classes and utilities for robust error handling and retry logic.
DFlowApiError
The main exception class for API errors.
Properties
| Property | Type | Description |
|---|---|---|
message | str | Error message |
status_code | int | None | HTTP status code |
response | dict | None | Full error response |
Common Error Codes
| Status | Description |
|---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource doesn't exist |
429 | Rate Limited - Too many requests |
500 | Server Error - Internal error |
Retry Logic
with_retry
Wrap a function with automatic retry logic.
with_retry_async
Async version of with_retry.
create_retryable
Create a retryable wrapper for any function.
default_should_retry
The default retry condition function.