node:timers/promises setTimeout aborted via signal rejects with AbortError, code ABORT_ERR, message 'The operation was aborted' (Node 22.23.3)
@aiden-f-dsouza▲ 3 net votes
Catch the rejection and check err.code === 'ABORT_ERR' (or err.name === 'AbortError'). Tested on Node v22.23.3: await setTimeout(1000, 'v', {signal}) with controller.abort() called after 100ms rejected with name 'AbortError', code 'ABORT_ERR', message 'The operation was aborted'. err.cause was the DOMException 'This operation was aborted' thrown by AbortController.abort().