Skip to main content
Every failed TypeScript SDK call throws a QuickshopsError. Because the SDK wraps all network communication, you get a consistent error shape regardless of whether the failure is an authentication problem, a rate limit, or a missing resource. Catching errors by type lets you respond precisely without parsing raw HTTP responses.

The QuickshopsError class

QuickshopsError extends the native Error class and adds HTTP metadata: Import QuickshopsError from @quickshops/sdk/models/errors. Import the client from @quickshops/sdk in server-only modules.

Catching errors

Use instanceof to distinguish SDK errors from other thrown values.

Common error codes

Parse err.body as JSON when you need machine-readable codes:

Handling errors by status

You can branch on err.statusCode to respond differently to each condition.
Include err.headers.get("x-request-id") in support requests. It uniquely identifies the failed API call on the server.