typescript.http_retry
Stability
Medium
Detects HTTP calls without retry logic for transient failures.
Why It Matters
Section titled “Why It Matters”Missing retry logic:
- Single-point failures — One network blip breaks everything
- Poor reliability — Transient errors not recovered
- User frustration — Failed requests that would succeed on retry
Example
Section titled “Example”// ❌ Before (no retry)async function fetchData(): Promise<Data> { return axios.get('/api/data').then(r => r.data);}// ✅ After (with retry logic)import axiosRetry from 'axios-retry';
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay, retryCondition: (error) => { return axiosRetry.isNetworkOrIdempotentRequestError(error) || error.response?.status === 429; },});
async function fetchData(): Promise<Data> { return axios.get('/api/data').then(r => r.data);}What Unfault Detects
Section titled “What Unfault Detects”- HTTP clients without retry configuration
- Missing exponential backoff
- No retry condition logic
Auto-Fix
Section titled “Auto-Fix”Unfault can add axios-retry or similar retry wrapper.