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

# SDK errors

> Typed HTTP errors thrown by @omni-commerce/sdk and the Omni CLI.

Non-2xx responses throw a subclass of `OmniError`. The CLI prints the same class name, message, and JSON body on stderr and exits `1`.

```ts theme={null}
import { OmniClient, NotFoundError, OmniError } from "@omni-commerce/sdk";

try {
  await client.products.get({ productId: "missing" });
} catch (error) {
  if (error instanceof NotFoundError) {
    // 404
  } else if (error instanceof OmniError) {
    console.error(error.statusCode, error.body);
  }
}
```

| Class                      | Status                                   |
| -------------------------- | ---------------------------------------- |
| `BadRequestError`          | 400                                      |
| `UnauthorizedError`        | 401                                      |
| `ForbiddenError`           | 403                                      |
| `NotFoundError`            | 404                                      |
| `UnprocessableEntityError` | 422                                      |
| `TooManyRequestsError`     | 429                                      |
| `InternalServerError`      | 500                                      |
| `BadGatewayError`          | 502                                      |
| `ServiceUnavailableError`  | 503                                      |
| `OmniTimeoutError`         | client timeout                           |
| `JobFailedError`           | `jobs.wait` ended `failed` / `cancelled` |

`OmniError` also exposes `statusCode`, `body`, and `rawResponse` when the failure came from HTTP.
