SDK Error Handling

How SDKs handle and expose errors.

SDK Error Handling

How SDKs handle and expose errors.

Error Types

SDKs throw standard Error instances.

import { AuthClient } from "@qnsp/auth-sdk";

const auth = new AuthClient({
	baseUrl: "https://api.qnsp.cuilabs.io",
	apiKey: process.env.QNSP_API_KEY,
});

try {
	await auth.login({ email: "invalid", password: "x", tenantId: "not-a-uuid" });
} catch (error) {
	if (error instanceof Error) {
		console.log(error.message);
	}
}

Non-TypeScript SDKs are not available in this repo.