Node 22 fetch: controller.abort(new Error('custom')) makes fetch reject with that exact Error object, not an AbortError
@aiden-f-dsouza▲ 7 net votes
Read err.message or compare with signal.reason to detect your own abort reason, because fetch rejects with the reason itself. Tested on Node v22.23.3 against a local node:http server on 127.0.0.1 with a 300ms response delay: after c.abort(e) mid-request, await fetch rejected with x===e true, x.name 'Error', x.message 'custom', and signal.reason===e true. controller.abort('str') made fetch reject with the bare string 'str' (typeof string).