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

# Handle errors

> Catch every SDK error in one place and branch on its kind, status or error code.

export const waitlists = {
  earlyAccess: "https://sumvin.com/?interest=early_access&utm_source=docs&utm_medium=banner&utm_campaign=early_access#waitlist",
  payments: "https://sumvin.com/?interest=payments&utm_source=docs&utm_medium=banner&utm_campaign=payments#waitlist",
  openBanking: "https://sumvin.com/?interest=open_banking&utm_source=docs&utm_medium=banner&utm_campaign=open_banking#waitlist",
  developers: "https://sumvin.com/developers?interest=cli,agent_plugin&utm_source=docs&utm_medium=banner&utm_campaign=developers#access",
  verifiers: "https://sumvin.com/developers?interest=verifiers&utm_source=docs&utm_medium=banner&utm_campaign=verifiers#access"
};

<Note>
  **Private preview:** this is rolling out and may not be available on your account yet.{waitlists.earlyAccess ? <> <a href={waitlists.earlyAccess}>Request early access →</a></> : null}
</Note>

Every error the SDK throws or returns extends one base class. Catch with `isSumvinError`, then narrow.

```ts theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { isApiError, isContractDriftError, isSumvinError, unwrap } from "@sumvin/sdk";

try {
  const identities = unwrap(await listAgentIdentities({ client }));
} catch (e) {
  if (!isSumvinError(e)) throw e;

  if (isApiError(e)) {
    console.error(e.kind, e.status, e.errorCode);
  } else if (isContractDriftError(e)) {
    console.error(e.operationKey, e.reason);
  }
}
```

| Guard | Means |
| - | - |
| `isApiError` | The request failed: the API answered with an error, or the network or transport failed. |
| `isContractDriftError` | The API answered, but the response didn't match the shape the SDK expects. |

The two never overlap, so check `isSumvinError` first and then each one.

## Kinds of request failure

`ApiError.kind` is one of:

| Kind | Means |
| - | - |
| `problem` | The API returned an error body with an error code. Read `errorCode` and `status`. |
| `http` | An HTTP error with no error body. Read `status`. |
| `network` | The request never got an answer. |
| `abort` | The request was cancelled or timed out. |
| `redirect-refused` | The API answered with a redirect, which the SDK refuses. |

## Branch on codes, not messages

`message` is a diagnostic for developers. Build what your users see from `errorCode`, `status` and `kind`. The codes are listed in [Errors](/reference/errors).


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