Skip to content

Error Handling

The SDKs provide standardized error handling.

try {
const response = await client.chat.completions.create({ ... });
} catch (error) {
if (error instanceof ExnestAI.APIError) {
console.error(error.status); // 400, 401, etc.
console.error(error.message);
} else {
throw error;
}
}