Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: inspect: do not crash on an Error with a regex name #56574

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented Jan 12, 2025

See #56570 - this avoids a crash with a regex set as the name property of an Error

@ljharb ljharb added the util Issues and PRs related to the built-in util module. label Jan 12, 2025
@ljharb ljharb requested review from jasnell and BridgeAR January 12, 2025 21:16
@ljharb ljharb force-pushed the inspect-regex-error-stack branch from 1f2a8f0 to d33853a Compare January 12, 2025 21:16
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jan 12, 2025
@ljharb ljharb changed the title util: inspect: do not crash on an Error insance with a regex name util: inspect: do not crash on an Error instance with a regex name Jan 12, 2025
@ljharb ljharb changed the title util: inspect: do not crash on an Error instance with a regex name util: inspect: do not crash on an Error with a regex name Jan 12, 2025
Copy link

codecov bot commented Jan 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.20%. Comparing base (2570f95) to head (a9638dc).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #56574   +/-   ##
=======================================
  Coverage   89.20%   89.20%           
=======================================
  Files         662      662           
  Lines      191817   191828   +11     
  Branches    36922    36928    +6     
=======================================
+ Hits       171101   171113   +12     
- Misses      13556    13561    +5     
+ Partials     7160     7154    -6     
Files with missing lines Coverage Δ
lib/internal/util/inspect.js 99.95% <100.00%> (+0.04%) ⬆️

... and 26 files with indirect coverage changes

@nodejs-github-bot
Copy link
Collaborator

@jasnell jasnell added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. and removed needs-ci PRs that need a full CI run. labels Jan 13, 2025
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

I think we could improve the result by logging even more information. It just requires a bit more code changes.

lib/internal/util/inspect.js Outdated Show resolved Hide resolved
@BridgeAR BridgeAR removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 13, 2025
@ljharb ljharb force-pushed the inspect-regex-error-stack branch 2 times, most recently from 0fcb903 to d842336 Compare January 13, 2025 20:08
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

I very much like the improved output!
It might be possible to unify some paths in the improveStack() method, while that's not critical in my opinion.

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. labels Jan 13, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 13, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95
Copy link
Contributor

aduh95 commented Jan 15, 2025

This needs a rebase

@ljharb ljharb force-pushed the inspect-regex-error-stack branch from d842336 to 73c0e96 Compare January 15, 2025 00:42
@ljharb ljharb force-pushed the inspect-regex-error-stack branch from 73c0e96 to a9638dc Compare January 15, 2025 00:47
@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

8 participants