Error thrown when retry attempts are exhausted
Thrown by the retry middleware when all retry attempts have been exhausted. Includes the number of attempts made and the last error encountered.
import { createFej, createRetryMiddleware, FejRetryError } from 'fej';const api = createFej();api.use('retry', createRetryMiddleware({ attempts: 3 }));try { await api.fej('/api/unreliable-endpoint');} catch (error) { if (error instanceof FejRetryError) { console.error(`Failed after ${error.attempts} attempts`); console.error('Last error:', error.lastError.message); }} Copy
import { createFej, createRetryMiddleware, FejRetryError } from 'fej';const api = createFej();api.use('retry', createRetryMiddleware({ attempts: 3 }));try { await api.fej('/api/unreliable-endpoint');} catch (error) { if (error instanceof FejRetryError) { console.error(`Failed after ${error.attempts} attempts`); console.error('Last error:', error.lastError.message); }}
Optional
Readonly
Error thrown when retry attempts are exhausted
Thrown by the retry middleware when all retry attempts have been exhausted. Includes the number of attempts made and the last error encountered.
Example