Error thrown when a request times out
Thrown by the timeout middleware when a request exceeds the configured timeout duration. Includes the timeout value that was exceeded.
import { createFej, createTimeoutMiddleware, FejTimeoutError } from 'fej';const api = createFej();api.use('timeout', createTimeoutMiddleware({ timeout: 5000 }));try { await api.fej('/api/slow-endpoint');} catch (error) { if (error instanceof FejTimeoutError) { console.error(`Request timed out after ${error.timeout}ms`); }} Copy
import { createFej, createTimeoutMiddleware, FejTimeoutError } from 'fej';const api = createFej();api.use('timeout', createTimeoutMiddleware({ timeout: 5000 }));try { await api.fej('/api/slow-endpoint');} catch (error) { if (error instanceof FejTimeoutError) { console.error(`Request timed out after ${error.timeout}ms`); }}
Optional
Readonly
Error thrown when a request times out
Thrown by the timeout middleware when a request exceeds the configured timeout duration. Includes the timeout value that was exceeded.
Example