import { ApiError, AuthenticationError, RetryExhaustedError } from "@keystoneos/sdk";
try {
await client.settlements.get("non-existent-id");
} catch (error) {
if (error instanceof ApiError) {
console.log(error.status); // 404
console.log(error.message); // "Settlement not found"
console.log(error.body); // Raw response body
console.log(error.headers); // Response headers
} else if (error instanceof AuthenticationError) {
// M2M credentials invalid or Auth0 unavailable
console.log(error.message);
} else if (error instanceof RetryExhaustedError) {
// All retries failed (429 or 5xx)
console.log(error.lastStatus); // 503
console.log(error.attempts); // 3
}
}