Skip to content

Fix SuppressedError nesting in the using error handling example - #46479

Merged
Josh-Cena merged 2 commits into
mdn:mainfrom
JorgeRojas2712:fix/using-suppressed-error-nesting
Nov 12, 2026
Merged

Josh-Cena merged 2 commits into
mdn:mainfrom
JorgeRojas2712:fix/using-suppressed-error-nesting

Conversation

@JorgeRojas2712

Copy link
Copy Markdown
Contributor

The error structure shown after the CantDisposeMe example doesn't match what the code throws. Resources are disposed in reverse order, so the error from resource1 ends up as the outer .error, the one from resource2 as the inner .error, and the original error from the main block as the innermost .suppressed.

Verified with Node 24 (v24.20.0), running the example exactly as written on the page:

SuppressedError: An error was suppressed during disposal
  error: Error: Can't dispose resource1
  suppressed: SuppressedError: An error was suppressed during disposal
    error: Error: Can't dispose resource2
    suppressed: Error: Error in main block

The following paragraph ("Each additional error is added as the error property…") is still accurate, so only the code block changes.

Fixes #46477

@JorgeRojas2712
JorgeRojas2712 requested a review from a team as a code owner November 11, 2026 21:02
@JorgeRojas2712
JorgeRojas2712 requested review from Josh-Cena and removed request for a team November 11, 2026 21:02
@github-actions github-actions Bot added Content:JS JavaScript docs size/s [PR only] 6-50 LoC changed labels Nov 11, 2026

@Josh-Cena Josh-Cena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@github-actions

Copy link
Copy Markdown
Contributor

@Josh-Cena
Josh-Cena merged commit 0b0bdf5 into mdn:main Nov 12, 2026
13 checks passed
pepelsbey added a commit to pepelsbey/mdn-content that referenced this pull request Nov 12, 2026
* upstream/main: (204 commits)
  [Editorial review] Add BiDi `network.setCacheBehavior` and `network.setExtraHeaders` pages (mdn#46140)
  build(deps-dev): bump @mdn/fred from 2.10.1 to 2.11.0 (mdn#46474)
  Reorder sections on HTML attribute pages (mdn#46483)
  Reorder sections on HTML element pages (mdn#46484)
  Fix live sample code block order in web API pages (mdn#46452)
  Move SVG attribute usage notes after examples (mdn#46458)
  Move SVG attribute elements section before examples (mdn#46459)
  Fix SuppressedError nesting in the `using` error handling example (mdn#46479)
  Editorial review: Document Web Audio render quantum size (mdn#46241)
  Remove the SVGAnimateColorElement page (mdn#46473)
  FF161 Relnote: Move WebTransport.anticipatedConcurrentIncoming{Uni|Bi}directionalStreams from 160 (mdn#46440)
  [WebExt] Screenshot updates to Nova (mdn#46270)
  build(deps-dev): bump cspell from 10.4.0 to 10.4.1 in the npm-dev group (mdn#46455)
  Update Firefox 160 release notes for WebDriver conforming changes. (mdn#46415)
  ci(deps): bump peter-evans/create-pull-request from 8.1.1 to 8.1.2 (mdn#46454)
  Move subtitles_en.vtt to shared-assets and update audio-video reference (mdn#46451)
  Yank Express Application Generator, migrate Express tutorial to ESM (mdn#45596)
  Fix heading sequence in web-api property pages (mdn#46450)
  Fix heading sequence in web-api interface pages (mdn#46448)
  Fix heading sequence in css-property pages (mdn#46447)
  ...

# Conflicts:
#	files/en-us/web/webdriver/reference/bidi/modules/network/index.md
#	files/sidebars/webdriver.yaml
pepelsbey added a commit to pepelsbey/mdn-content that referenced this pull request Nov 12, 2026
…epts

* upstream/main: (195 commits)
  [Editorial review] Add BiDi `network.setCacheBehavior` and `network.setExtraHeaders` pages (mdn#46140)
  build(deps-dev): bump @mdn/fred from 2.10.1 to 2.11.0 (mdn#46474)
  Reorder sections on HTML attribute pages (mdn#46483)
  Reorder sections on HTML element pages (mdn#46484)
  Fix live sample code block order in web API pages (mdn#46452)
  Move SVG attribute usage notes after examples (mdn#46458)
  Move SVG attribute elements section before examples (mdn#46459)
  Fix SuppressedError nesting in the `using` error handling example (mdn#46479)
  Editorial review: Document Web Audio render quantum size (mdn#46241)
  Remove the SVGAnimateColorElement page (mdn#46473)
  FF161 Relnote: Move WebTransport.anticipatedConcurrentIncoming{Uni|Bi}directionalStreams from 160 (mdn#46440)
  [WebExt] Screenshot updates to Nova (mdn#46270)
  build(deps-dev): bump cspell from 10.4.0 to 10.4.1 in the npm-dev group (mdn#46455)
  Update Firefox 160 release notes for WebDriver conforming changes. (mdn#46415)
  ci(deps): bump peter-evans/create-pull-request from 8.1.1 to 8.1.2 (mdn#46454)
  Move subtitles_en.vtt to shared-assets and update audio-video reference (mdn#46451)
  Yank Express Application Generator, migrate Express tutorial to ESM (mdn#45596)
  Fix heading sequence in web-api property pages (mdn#46450)
  Fix heading sequence in web-api interface pages (mdn#46448)
  Fix heading sequence in css-property pages (mdn#46447)
  ...

# Conflicts:
#	files/sidebars/webdriver.yaml
pepelsbey added a commit to pepelsbey/mdn-content that referenced this pull request Nov 12, 2026
…tication

* upstream/main: (186 commits)
  [Editorial review] Add BiDi `network.setCacheBehavior` and `network.setExtraHeaders` pages (mdn#46140)
  build(deps-dev): bump @mdn/fred from 2.10.1 to 2.11.0 (mdn#46474)
  Reorder sections on HTML attribute pages (mdn#46483)
  Reorder sections on HTML element pages (mdn#46484)
  Fix live sample code block order in web API pages (mdn#46452)
  Move SVG attribute usage notes after examples (mdn#46458)
  Move SVG attribute elements section before examples (mdn#46459)
  Fix SuppressedError nesting in the `using` error handling example (mdn#46479)
  Editorial review: Document Web Audio render quantum size (mdn#46241)
  Remove the SVGAnimateColorElement page (mdn#46473)
  FF161 Relnote: Move WebTransport.anticipatedConcurrentIncoming{Uni|Bi}directionalStreams from 160 (mdn#46440)
  [WebExt] Screenshot updates to Nova (mdn#46270)
  build(deps-dev): bump cspell from 10.4.0 to 10.4.1 in the npm-dev group (mdn#46455)
  Update Firefox 160 release notes for WebDriver conforming changes. (mdn#46415)
  ci(deps): bump peter-evans/create-pull-request from 8.1.1 to 8.1.2 (mdn#46454)
  Move subtitles_en.vtt to shared-assets and update audio-video reference (mdn#46451)
  Yank Express Application Generator, migrate Express tutorial to ESM (mdn#45596)
  Fix heading sequence in web-api property pages (mdn#46450)
  Fix heading sequence in web-api interface pages (mdn#46448)
  Fix heading sequence in css-property pages (mdn#46447)
  ...

# Conflicts:
#	files/sidebars/webdriver.yaml
pepelsbey added a commit to pepelsbey/mdn-content that referenced this pull request Nov 12, 2026
* upstream/main: (186 commits)
  [Editorial review] Add BiDi `network.setCacheBehavior` and `network.setExtraHeaders` pages (mdn#46140)
  build(deps-dev): bump @mdn/fred from 2.10.1 to 2.11.0 (mdn#46474)
  Reorder sections on HTML attribute pages (mdn#46483)
  Reorder sections on HTML element pages (mdn#46484)
  Fix live sample code block order in web API pages (mdn#46452)
  Move SVG attribute usage notes after examples (mdn#46458)
  Move SVG attribute elements section before examples (mdn#46459)
  Fix SuppressedError nesting in the `using` error handling example (mdn#46479)
  Editorial review: Document Web Audio render quantum size (mdn#46241)
  Remove the SVGAnimateColorElement page (mdn#46473)
  FF161 Relnote: Move WebTransport.anticipatedConcurrentIncoming{Uni|Bi}directionalStreams from 160 (mdn#46440)
  [WebExt] Screenshot updates to Nova (mdn#46270)
  build(deps-dev): bump cspell from 10.4.0 to 10.4.1 in the npm-dev group (mdn#46455)
  Update Firefox 160 release notes for WebDriver conforming changes. (mdn#46415)
  ci(deps): bump peter-evans/create-pull-request from 8.1.1 to 8.1.2 (mdn#46454)
  Move subtitles_en.vtt to shared-assets and update audio-video reference (mdn#46451)
  Yank Express Application Generator, migrate Express tutorial to ESM (mdn#45596)
  Fix heading sequence in web-api property pages (mdn#46450)
  Fix heading sequence in web-api interface pages (mdn#46448)
  Fix heading sequence in css-property pages (mdn#46447)
  ...

# Conflicts:
#	files/sidebars/webdriver.yaml
pepelsbey added a commit to pepelsbey/mdn-content that referenced this pull request Nov 12, 2026
…ollectors

* upstream/main: (186 commits)
  [Editorial review] Add BiDi `network.setCacheBehavior` and `network.setExtraHeaders` pages (mdn#46140)
  build(deps-dev): bump @mdn/fred from 2.10.1 to 2.11.0 (mdn#46474)
  Reorder sections on HTML attribute pages (mdn#46483)
  Reorder sections on HTML element pages (mdn#46484)
  Fix live sample code block order in web API pages (mdn#46452)
  Move SVG attribute usage notes after examples (mdn#46458)
  Move SVG attribute elements section before examples (mdn#46459)
  Fix SuppressedError nesting in the `using` error handling example (mdn#46479)
  Editorial review: Document Web Audio render quantum size (mdn#46241)
  Remove the SVGAnimateColorElement page (mdn#46473)
  FF161 Relnote: Move WebTransport.anticipatedConcurrentIncoming{Uni|Bi}directionalStreams from 160 (mdn#46440)
  [WebExt] Screenshot updates to Nova (mdn#46270)
  build(deps-dev): bump cspell from 10.4.0 to 10.4.1 in the npm-dev group (mdn#46455)
  Update Firefox 160 release notes for WebDriver conforming changes. (mdn#46415)
  ci(deps): bump peter-evans/create-pull-request from 8.1.1 to 8.1.2 (mdn#46454)
  Move subtitles_en.vtt to shared-assets and update audio-video reference (mdn#46451)
  Yank Express Application Generator, migrate Express tutorial to ESM (mdn#45596)
  Fix heading sequence in web-api property pages (mdn#46450)
  Fix heading sequence in web-api interface pages (mdn#46448)
  Fix heading sequence in css-property pages (mdn#46447)
  ...

# Conflicts:
#	files/sidebars/webdriver.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:JS JavaScript docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

using: incorrect SuppressedError nesting in the Error handling example

2 participants

⌂ 换网址