Response and Error Handling
Learn about response and error handling in your app.
Response and error handling
The SDK returns a consistent response shape:
Success
{
data: T,
error: null,
status: number,
correlationID: string,
headers: Headers
}Failure
{
data: null,
error: AarthikError,
status?: number,
correlationID: string,
headers?: Headers
}Stable error codes
CONFIG_ERROR— configuration issue (invalid baseURL, missing fetch, etc.)NETWORK_ERROR— connectivity / fetch failuresTIMEOUT— request exceeded timeoutABORTED— canceled viaAbortController/AbortSignalHTTP_ERROR— non-2xx responsePARSE_ERROR— response parsing failedUNKNOWN_ERROR— safe fallback
Recommended handling pattern
- Log
correlationIDanderror.code - Retry on retryable failure modes (depending on UX)
- Provide “Try again” UI for user-controlled retries when appropriate