Skip to content

util: show SuppressedError's error/suppressed properties on inspect - #66159

Open
agape1225 wants to merge 1 commit into
nodejs:mainfrom
agape1225:util-inspect-suppressed-error
Open

agape1225 wants to merge 1 commit into
nodejs:mainfrom
agape1225:util-inspect-suppressed-error

Conversation

@agape1225

Copy link
Copy Markdown
Contributor

util.inspect() (and console.log()) silently dropped a SuppressedError's error and suppressed properties, the two pieces of information needed to actually debug a disposal failure. Both properties are non-enumerable, so they never showed up without this.

formatError() already special-cases two other non-enumerable "container" properties for the same reason: Error's cause (#41002) and AggregateError's errors (#43646). Handle SuppressedError's error and suppressed the same way; nested SuppressedErrors (from multiple failed disposals) are shown recursively since inspect() already recurses into any Error-valued property.

Fixes: #66033

util.inspect() (and console.log()) silently dropped a SuppressedError's
`error` and `suppressed` properties, the two pieces of information
needed to actually debug a disposal failure. Both properties are
non-enumerable, so they never showed up without this.

formatError() already special-cases two other non-enumerable
"container" properties for the same reason: Error's `cause` (nodejs#41002)
and AggregateError's `errors` (nodejs#43646). Handle SuppressedError's
`error` and `suppressed` the same way; nested SuppressedErrors (from
multiple failed disposals) are shown recursively since inspect()
already recurses into any Error-valued property.

Fixes: nodejs#66033

Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Sep 20, 2026
@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.28%. Comparing base (25e6c15) to head (0f7d877).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/util/inspect.js 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66159      +/-   ##
==========================================
+ Coverage   90.27%   90.28%   +0.01%     
==========================================
  Files         790      790              
  Lines      271981   271991      +10     
  Branches    51913    51948      +35     
==========================================
+ Hits       245531   245574      +43     
+ Misses      16945    16905      -40     
- Partials     9505     9512       +7     
Files with missing lines Coverage Δ
lib/internal/util/inspect.js 97.04% <90.00%> (-0.03%) ⬇️

... and 27 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Renegade334 Renegade334 added the dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. label Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

util: SuppressedError should print error/suppressed properties during inspection

3 participants