Title: Thrown AbortErrors are not DOMExceptions · Issue #40692 · nodejs/node · GitHub
Open Graph Title: Thrown AbortErrors are not DOMExceptions · Issue #40692 · nodejs/node
X Title: Thrown AbortErrors are not DOMExceptions · Issue #40692 · nodejs/node
Description: Version v17.0.1 Platform any Subsystem No response What steps will reproduce the bug? import { readFile } from 'fs/promises'; const ref = new DOMException('The operation was aborted', 'AbortError'); console.log('REF INSTANCE', ref instan...
Open Graph Description: Version v17.0.1 Platform any Subsystem No response What steps will reproduce the bug? import { readFile } from 'fs/promises'; const ref = new DOMException('The operation was aborted', 'AbortError')...
X Description: Version v17.0.1 Platform any Subsystem No response What steps will reproduce the bug? import { readFile } from 'fs/promises'; const ref = new DOMException('The operation was aborted'...
Opengraph URL: https://github.com/nodejs/node/issues/40692
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Thrown AbortErrors are not DOMExceptions","articleBody":"### Version\n\nv17.0.1\n\n### Platform\n\nany\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\n```js\r\nimport { readFile } from 'fs/promises';\r\n\r\nconst ref = new DOMException('The operation was aborted', 'AbortError');\r\nconsole.log('REF INSTANCE', ref instanceof DOMException);\r\nconsole.log('REF OBJECT', ref);\r\n\r\nconst ab = new AbortController();\r\nab.abort();\r\n\r\ntry {\r\n await readFile('does_not_matter', { signal: ab.signal });\r\n}\r\ncatch (err) {\r\n console.log('ERR INSTANCE', err instanceof DOMException);\r\n console.log('ERR OBJECT', err);\r\n}\r\n```\n\n### How often does it reproduce? Is there a required condition?\n\n100%, including for all other native APIs that supports signals.\n\n### What is the expected behavior?\n\nFrom the docs:\r\n\r\n> If a request is aborted the promise returned is rejected with an `AbortError`\r\n\r\nThere 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).\n\n### What do you see instead?\n\n```\r\nREF INSTANCE true\r\nREF OBJECT DOMException [AbortError]: The operation was aborted\r\n at file://\u003csnip>/fail.mjs:3:13\r\n at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\r\n at async Promise.all (index 0)\r\n at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\r\n at async loadESM (node:internal/process/esm_loader:88:5)\r\n at async handleMainPromise (node:internal/modules/run_main:65:12)\r\nERR INSTANCE false\r\nERR OBJECT AbortError: The operation was aborted\r\n at checkAborted (node:internal/fs/promises:373:11)\r\n at readFile (node:internal/fs/promises:845:3)\r\n at file://\u003csnip>/fail.mjs:11:11\r\n at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\r\n at async Promise.all (index 0)\r\n at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\r\n at async loadESM (node:internal/process/esm_loader:88:5)\r\n at async handleMainPromise (node:internal/modules/run_main:65:12) {\r\n code: 'ABORT_ERR'\r\n}\r\n```\n\n### Additional information\n\nThis is only an issue in node 17+, since previous versions did not have a `DOMException` global.","author":{"url":"https://github.com/kanongil","@type":"Person","name":"kanongil"},"datePublished":"2021-11-01T13:56:23Z","url":"https://github.com/nodejs/node/issues/40692"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5d00c8f7-ac28-b4da-0983-5b4e33c7041d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D404:34E7AF:8616E2:AF7BDA:6AED38FC |
| html-safe-nonce | 57d44428cdc982e8019ac29a6e0f2e40f6a386f5a08d3f6457b443bf9e5fc3fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDA0OjM0RTdBRjo4NjE2RTI6QUY3QkRBOjZBRUQzOEZDIiwidmlzaXRvcl9pZCI6IjI1NDY3MjMwOTA3MDc4NTU2MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3eefaef6b85900726be5b5b49904cfb2846204405cf935956cf988e125496634 |
| hovercard-subject-tag | issue:1041201333 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/40692/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9cba79120f5b492e02a9992e7580f6db19acfa9ef7e296d6b4d39a1eaba2a3f6/nodejs/node/issues/40692 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9cba79120f5b492e02a9992e7580f6db19acfa9ef7e296d6b4d39a1eaba2a3f6/nodejs/node/issues/40692 |
| og:image:alt | Version v17.0.1 Platform any Subsystem No response What steps will reproduce the bug? import { readFile } from 'fs/promises'; const ref = new DOMException('The operation was aborted', 'AbortError')... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kanongil |
| hostname | github.com |
| expected-hostname | github.com |
| None | 26c92a9388ddfad3fa88d132b5d5f0b4747030233dcc4e5efb05f1cbae152184 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c629ad99c254d306375fc8354d04321c2c362236 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width