Reliability
Error Handling
Handle SDK errors, HTTP status codes, network failures, and retryable requests.
Overview
All official clients raise a language-native SDK error when the API returns a non-2xx response. The error includes a message and status code so your app can handle authentication, validation, throttling, and server failures deliberately.
Error types
JavaScript / TypeScript
CheFuAcademyErrorPython
CheFuAcademyErrorGo
*chefuacademy.ErrorJava
CheFuAcademyException.NET
CheFuAcademyExceptionPHP
CheFuAcademyExceptionRuby
CheFuAcademy::ErrorcURL
HTTP status + response bodyStatus codes
400Invalid request or malformed parameters.
401Missing, invalid, or expired API key or user session.
403Revoked key or insufficient developer permissions.
404The course, video, or key was not found.
429Rate limit exceeded. Retry after waiting.
500Unexpected CheFu Academy server issue.
Handling failures
Use the SDK error type for your language and branch on status code when your app needs a specific recovery path.
Catch SDK errors
Keep detailed logs private and show user-friendly messages.
JavaScript / TypeScript
chefu-academy-sdk - npm
import { CheFuAcademyError } from 'chefu-academy-sdk';
try {
return await sdk.courses.getAll({ limit: 12 });
} catch (error) {
if (error instanceof CheFuAcademyError) {
if (error.statusCode === 401) {
throw new Error('Check CHEFU_API_KEY.');
}
if (error.statusCode === 429) {
throw new Error('Too many requests. Retry shortly.');
}
throw new Error(error.message);
}
throw error;
}Network errors may not include a status code
Treat errors without a status code as connectivity, DNS, timeout, or local environment problems.
Production guidance
- Show user-friendly messages and log detailed errors privately.
Retry only safe read operations, and use backoff for 429 or transient 5xx errors.
- Do not log full API keys, passwords, or bearer tokens.
- Fail closed when authentication or permissions are unclear.