Error Types
Import error classes to handle specific error types:Basic Error Handling
Handle errors with try-catch blocks:Error Types Reference
| Error | Status | Description |
|---|---|---|
BadRequestError | 400 | Invalid request parameters |
AuthenticationError | 401 | Missing or invalid API key |
PermissionDeniedError | 403 | Insufficient permissions |
NotFoundError | 404 | Resource not found |
ConflictError | 409 | Resource conflict (e.g., duplicate space name) |
UnprocessableEntityError | 422 | Validation error |
RateLimitError | 429 | Too many requests |
InternalServerError | 5xx | Server error |
TimeoutError | - | Request timeout |
ConnectionError | - | Network connectivity issue |
Rate Limit Handling
Handle rate limits with retry logic:Error Properties
All error instances include useful properties:RateLimitError Properties
RateLimitError includes additional properties:
Type-Safe Error Handling
TypeScript provides full type safety for error handling:Common Error Scenarios
Invalid API Key
Resource Not Found
Validation Errors
Network Issues
Error Handling Best Practices
Handle Specific Errors
Catch specific error types to provide better user feedback and handle each case appropriately.
Retry Rate Limits
Implement retry logic for
RateLimitError using the retryAfter property.Log Errors
Log errors with context (request details, user ID, etc.) for debugging.
Graceful Degradation
Provide fallback behavior when errors occur (e.g., show cached data or default message).