PluginsPagerDuty
PagerDuty Error Handlers
Built-in and custom error handling for PagerDuty
The PagerDuty plugin includes built-in error handlers for common PagerDuty API error scenarios.
New to Corsair? Learn about error handling before customizing error handlers.
Full Implementation: See the PagerDuty 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
await corsair.pagerduty.api.incidents.list({
limit: 100,
});Authentication Errors
Triggers: HTTP 401 status or errors containing invalid credentials
Behavior:
- Maximum retries: 0 (no retries)
- Fails immediately
How to Fix:
- Verify your API key is valid and not expired
- Ensure the API key has the required permissions
- Check if the key was revoked in PagerDuty
Permission Errors
Triggers: HTTP 403 status
Behavior:
- Maximum retries: 0 (no retries)
- Fails immediately
How to Fix:
- Verify the API key has access to the requested resource
- Check user role permissions in PagerDuty
Not Found Errors
Triggers: HTTP 404 status
Behavior:
- Maximum retries: 0 (no retries)
- Fails immediately
Network Errors
Triggers: Connection errors, timeouts
Behavior:
- Maximum retries: 3
- Uses exponential backoff
Custom Error Handlers
pagerduty({
errorHandlers: {
MAINTENANCE_WINDOW: {
match: (error) => {
return error.message.includes("maintenance");
},
handler: async (error, context) => {
return {
maxRetries: 5,
headersRetryAfterMs: 60000,
};
},
},
},
})For comprehensive error handling strategies, patterns, and best practices, see the Error Handling concepts page.