Version
v17.0.1
Platform
any
Subsystem
No response
What steps will reproduce the bug?
import{readFile}from'fs/promises';constref=newDOMException('The operation was aborted','AbortError');console.log('REF INSTANCE',refinstanceofDOMException);console.log('REF OBJECT',ref);constab=newAbortController();ab.abort();try{awaitreadFile('does_not_matter',{signal: ab.signal});}catch(err){console.log('ERR INSTANCE',errinstanceofDOMException);console.log('ERR OBJECT',err);}How often does it reproduce? Is there a required condition?
100%, including for all other native APIs that supports signals.
What is the expected behavior?
From the docs:
If a request is aborted the promise returned is rejected with an AbortError
There is no mention that this is a non-standard new DOMException(message, 'AbortError') error. As such, I expect 'REF' and 'ERR' logged objects to be the same (except the stack).
What do you see instead?
REF INSTANCE true
REF OBJECT DOMException [AbortError]: The operation was aborted
at file://<snip>/fail.mjs:3:13
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
ERR INSTANCE false
ERR OBJECT AbortError: The operation was aborted
at checkAborted (node:internal/fs/promises:373:11)
at readFile (node:internal/fs/promises:845:3)
at file://<snip>/fail.mjs:11:11
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12) {
code: 'ABORT_ERR'
}
Additional information
This is only an issue in node 17+, since previous versions did not have a DOMException global.
Version
v17.0.1
Platform
any
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
100%, including for all other native APIs that supports signals.
What is the expected behavior?
From the docs:
There is no mention that this is a non-standard
new DOMException(message, 'AbortError')error. As such, I expect 'REF' and 'ERR' logged objects to be the same (except the stack).What do you see instead?
Additional information
This is only an issue in node 17+, since previous versions did not have a
DOMExceptionglobal.