Early Access: Concepts and architecture are stable; some API names and module boundaries may evolve.
Credit SDK by Aarthik Labs

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 failures
  • TIMEOUT — request exceeded timeout
  • ABORTED — canceled via AbortController / AbortSignal
  • HTTP_ERROR — non-2xx response
  • PARSE_ERROR — response parsing failed
  • UNKNOWN_ERROR — safe fallback
  • Log correlationID and error.code
  • Retry on retryable failure modes (depending on UX)
  • Provide “Try again” UI for user-controlled retries when appropriate

On this page