Skip to main content

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 CodeDescriptionCommon CausesResolution
400Bad RequestInvalid parameters, Missing required fieldsCheck request format
401UnauthorizedInvalid/expired tokenRefresh authentication
403ForbiddenInsufficient permissionsCheck access rights
404Not FoundInvalid resource IDVerify resource exists
409ConflictResource already existsCheck existing resources
429Too Many RequestsRate limit exceededImplement backoff
500Server ErrorInternal system errorRetry 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

  1. Check credential validity
  2. Verify token expiration
  3. Confirm proper token format
  4. Check environment-specific credentials