Rate Limiting
Prevent duplicate errors from flooding your inbox with automatic rate limiting.
How It Works
When the same error occurs multiple times within the rate limit window, only the first occurrence is sent. Errors are identified by their message and stack trace location.
Configuration
import { configureErrorReporting } from 'errormail'; configureErrorReporting({ apiKey: 'your-api-key', rateLimitMs: 5000 // 5 seconds (default) });
Example
If the same error occurs 10 times in 1 second with a 5-second rate limit:
1st error→ Sent to API
2nd-10th errors→ Skipped (within rate limit)
After 5 seconds→ Next occurrence will be sent
Adjusting Rate Limit
// Shorter rate limit for critical environments configureErrorReporting({ rateLimitMs: 1000 // 1 second }); // Longer rate limit for high-traffic apps configureErrorReporting({ rateLimitMs: 30000 // 30 seconds }); // Disable rate limiting (not recommended) configureErrorReporting({ rateLimitMs: 0 });