PluginsCal.com
Cal.com Error Handlers
Built-in and custom error handling for Cal.com
The Cal plugin includes built-in error handlers for common Cal.com API error scenarios.
New to Corsair? Learn about error handling before customizing error handlers.
Full Implementation: See the Cal plugin source code.
Built-in Error Handlers
Rate Limit Errors
Triggers: HTTP 429 status
Behavior:
- Maximum retries: 5
- Respects
Retry-Afterheader
Example:
// Corsair handles rate limits automatically
const bookings = await corsair.cal.api.bookings.list({
limit: 50,
});Authentication Errors
Triggers: HTTP 401 status, invalid API key
Behavior:
- Maximum retries: 0 (no retries)
- Fails immediately
How to Fix:
- Verify your Cal.com API key is valid
- Check the key has not expired or been revoked in your Cal.com account settings
Not Found Errors
Triggers: HTTP 404 status, booking UID does not exist
Behavior:
- Maximum retries: 0 (no retries)
How to Fix:
- Verify the booking UID exists
- Check that the booking has not already been deleted
Conflict Errors
Triggers: HTTP 409 status, time slot already booked
Behavior:
- Maximum retries: 0 (no retries)
How to Fix:
- Check availability before creating a booking
- Select a different time slot
Network Errors
Triggers: Connection errors, timeouts
Behavior:
- Maximum retries: 3
- Uses exponential backoff
Custom Error Handlers
cal({
errorHandlers: {
SLOT_UNAVAILABLE: {
match: (error) => {
return error.message.includes("slot_unavailable");
},
handler: async (error, context) => {
console.log("Requested time slot is no longer available");
return {
maxRetries: 0,
};
},
},
},
})For comprehensive error handling strategies, patterns, and best practices, see the Error Handling concepts page.