> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cantor8.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Error handling

> Handle wallet connection, approval, data, and transaction errors.

SDK methods reject with an error object that includes a stable `code` field. Switch on `err.code` to handle each case.

```js theme={null}
try {
  const { txId } = await c8.send({ /* ... */ });
} catch (err) {
  switch (err.code) {
    case 'USER_REJECTED':       /* ... */ break;
    case 'INSUFFICIENT_FUNDS':  /* ... */ break;
    case 'POPUP_BLOCKED':       /* ... */ break;
    case 'NOT_CONNECTED':       /* ... */ break;
    // ...
  }
}
```

## Error codes

> **USER\_REJECTED**
>
> The user dismissed the approval popup. Prompt them to retry the action.

> **INSUFFICIENT\_FUNDS**
>
> The selected holding's balance is too low for the requested transfer. Surface a clear "not enough balance" message to the user.

> **POPUP\_BLOCKED**
>
> The browser blocked the wallet popup. Call interactive methods such as `connect()`, `send()`, `createSwapOffer()`, `signMessage()`, and `signAndExecute()` from a user gesture such as a button click.

> **NOT\_CONNECTED**
>
> The method was called before `connect()`. Call `await c8.connect()` first.

> **INITIALIZATION\_FAILED**
>
> The provider failed to initialize. Verify your `C8WalletProvider` config (`dappName`, `network`).

> **TRANSFER\_PREPARATION\_FAILED**
>
> The wallet could not prepare the transfer. Often indicates invalid `senderPartyId`, `instrumentId`, or `amount`.

> **EXECUTION\_FAILED**
>
> The transfer was submitted but failed to execute on the Canton ledger.

> **FAILED\_TO\_FETCH\_TRANSFER\_STATUS**
>
> Could not retrieve transfer status. Retry, or check connectivity to the Canton network.

> **FETCH\_INSTRUMENTS\_FAILED**
>
> `getInstruments()` failed. Verify the wallet is connected and reachable.

> **FETCH\_ACCOUNTS\_FAILED**
>
> `getAccounts()` failed. Verify the wallet is connected and reachable.

> **CHECK\_TX\_STATUS\_FAILED**
>
> `checkTxStatusById()` failed. The `txId` may be invalid or the ledger may be temporarily unreachable.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.