I Built a Retry Library Becaus... Note

I Built a Retry Library Because I Kept Losing Failed API Calls

Existing retry libraries often simply throw an error after exhausting retries, leading to lost information about failed requests. This makes it difficult to diagnose issues, such as silently dropped webhooks. The author developed smart-retry, a TypeScript library designed to address this. Smart-retry offers drop-in support for Axios and Fetch clients, going beyond generic function wrappers. A key feature is its automatic logging of failed requests to disk when all retries are exhausted. This log includes crucial details like the URL, method, headers, and body, allowing for later inspection or replaying. By contrast, traditional libraries lose this information upon throwing an error. The library defaults to retrying only network errors, timeouts, 429, and 5xx responses, but this behavior can be customized. The author is seeking contributions to improve the library, specifically to fix Axios timeout error handling, add test coverage, implement a max delay for exponential backoff, reduce public type usage, and document log rotation. Setup instructions are available in the CONTRIBUTING.md file, and feedback is welcome.