Error Handling
This guide covers the various errors you might encounter when using the azakaw API and how to handle them appropriately.
Error Response Format
All API errors follow a consistent format:
{
"version": null,
"statusCode": 400,
"messages": [
"Detailed error message"
],
"result": null
}
HTTP Status Codes
Status Code | Description | Common Causes | Resolution |
---|---|---|---|
400 | Bad Request | Invalid parameters, Missing required fields | Check request format |
401 | Unauthorized | Invalid/expired token | Refresh authentication |
403 | Forbidden | Insufficient permissions | Check access rights |
404 | Not Found | Invalid resource ID | Verify resource exists |
409 | Conflict | Resource already exists | Check existing resources |
429 | Too Many Requests | Rate limit exceeded | Implement backoff |
500 | Server Error | Internal system error | Retry with backoff |
Error Handling Best Practices
Implement Retry Logic
async function apiCallWithRetry(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (!isRetryableError(error) || i === maxRetries - 1) {
throw error;
}
await delay(Math.pow(2, i) * 1000);
}
}
}
Troubleshooting Guide
Authentication Issues
- Check credential validity
- Verify token expiration
- Confirm proper token format
- Check environment-specific credentials