Error Handling Guide
Learn how to handle errors gracefully and implement robust retry logic in your WhizoAI integrations.Overview
Proper error handling is crucial for building reliable applications with WhizoAI. This guide covers common error scenarios, response formats, and best practices for handling failures.Error Response Format
All API errors follow a consistent format:Common Error Codes
Authentication Errors
| Code | HTTP Status | Description | Solution |
|---|---|---|---|
INVALID_API_KEY | 401 | API key is invalid or missing | Check API key format and permissions |
API_KEY_EXPIRED | 401 | API key has expired | Generate a new API key |
ACCOUNT_SUSPENDED | 403 | Account has been suspended | Contact support |
Rate Limiting Errors
| Code | HTTP Status | Description | Solution |
|---|---|---|---|
RATE_LIMIT_EXCEEDED | 429 | Too many requests | Implement exponential backoff |
DAILY_LIMIT_EXCEEDED | 429 | Daily quota exceeded | Upgrade plan or wait for reset |
CONCURRENT_LIMIT_EXCEEDED | 429 | Too many concurrent jobs | Wait for jobs to complete |
Credit Errors
| Code | HTTP Status | Description | Solution |
|---|---|---|---|
INSUFFICIENT_CREDITS | 402 | Not enough credits | Purchase more credits or upgrade plan |
CREDIT_CALCULATION_ERROR | 500 | Error calculating credit cost | Retry request |
Scraping Errors
| Code | HTTP Status | Description | Solution |
|---|---|---|---|
URL_NOT_ACCESSIBLE | 400 | Cannot access the target URL | Check URL validity and accessibility |
TIMEOUT | 408 | Request timed out | Increase timeout or retry |
BLOCKED_BY_ROBOT_TXT | 403 | URL blocked by robots.txt | Respect robots.txt or use different URL |
JAVASCRIPT_ERROR | 500 | JavaScript execution failed | Disable JavaScript or use different engine |
Retry Strategies
Exponential Backoff
Implement exponential backoff for transient errors:Rate Limit Handling
Handle rate limits gracefully:Circuit Breaker Pattern
Implement circuit breaker to prevent cascading failures:Error Recovery Strategies
Graceful Degradation
Implement fallback mechanisms:Partial Success Handling
Handle batch operations with partial failures:Monitoring and Alerting
Error Tracking
Implement comprehensive error logging:Health Checks
Monitor API health:Best Practices
- Always Handle Errors - Never ignore API errors
- Implement Retry Logic - Use exponential backoff for transient errors
- Respect Rate Limits - Monitor and handle 429 responses properly
- Log Everything - Maintain comprehensive error logs
- Monitor Error Rates - Set up alerts for high error frequencies
- Graceful Degradation - Implement fallback strategies
- Circuit Breaker - Prevent cascading failures
- Validate Inputs - Check parameters before API calls