AbortSignal.any: Cancel fetch on Timeout or User Action
Promise.race can reject without stopping fetch. Compose a timeout signal and a fresh cancellation controller with AbortSignal.any, then pass the composite to fetch. The same signal also protects the response body read. The first abort wins and preserves its reason. Check HTTP status separately, and remember that client cancellation does not roll back server work. Full write-up and runnable example: https://hackyjs.com/posts/using-abortsignalany-to-compose-timeout-and-cancellation-signals-in-fetch
javascriptfetchabortsignalweb-apiscancellation