Type guard to check if an error is a TimeoutError
Error to check
true if error is a TimeoutError
try { await withTimeout(operation(), 5000);} catch (error) { if (isTimeoutError(error)) { console.error('Operation timed out:', error.timeoutMs); }} Copy
try { await withTimeout(operation(), 5000);} catch (error) { if (isTimeoutError(error)) { console.error('Operation timed out:', error.timeoutMs); }}
0.8.0
Type guard to check if an error is a TimeoutError