Your fetch timeout starts before the request does
AbortSignal.timeout() starts counting when you create it, not when fetch runs. In a queue or retry loop it quietly kills requests still waiting their turn.
4 posts
AbortSignal.timeout() starts counting when you create it, not when fetch runs. In a queue or retry loop it quietly kills requests still waiting their turn.
A network timeout and a 404 are not the same problem and shouldn't be handled with the same catch block. Here's the typed error hierarchy, and when safeMode is worth the tradeoff.
window.onerror is the answer everyone gives. It never fires for a broken image, and the next library that loads can delete yours. Here is what to use instead, on the client and on the server, tested in a real browser.
Error objects have non-enumerable fields, so a logger that just JSON.stringify's them prints an empty object. Here's why, and a serializer that captures message, stack, cause chains, and AggregateErrors properly.