Skip to content

[devtools] Allow inspecting cause, name, message, stack of Errors in props #33023

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

Merged
merged 2 commits into from
Apr 26, 2025

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Apr 25, 2025

Summary

These are not enumerable properties (which is why we ommitted those previously) yet they're still interesting. I feel like for Errors special casing is warranted.

After:
CleanShot 2025-04-25 at 18 10 54@2x

Before:
CleanShot 2025-04-25 at 18 12 17@2x

How did you test this change?

  • added showcase in shell
  • local build

isPathAllowedCheck ? 1 : level + 1,
);

if ('cause' in data) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will be false if no cause was actually included ('cause' in new Error('test')) but true if it was (even if undefined) ('cause' in new Error('test', { cause: undefined }))

Copy link
Contributor

@hoxyq hoxyq left a comment

Choose a reason for hiding this comment

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

This is awesome!

Could you also try right-clicking on the Error value and selecting "Store as global variable"? I wonder if it will be printed out in a console with a symbolicated stack right away, that would be nice.

@eps1lon
Copy link
Collaborator Author

eps1lon commented Apr 26, 2025

I wonder if it will be printed out in a console with a symbolicated stack right away, that would be nice.

That worked before already. "Copy to clipboard" is still just an empty object though.

@eps1lon eps1lon force-pushed the sebbie/inspect-errors branch from 551ce37 to 3e010ac Compare April 26, 2025 05:13
@eps1lon eps1lon merged commit c498bfc into facebook:main Apr 26, 2025
239 checks passed
@eps1lon eps1lon deleted the sebbie/inspect-errors branch April 26, 2025 06:56
github-actions bot pushed a commit to shlomiNugarker/react that referenced this pull request Apr 27, 2025
github-actions bot pushed a commit to shlomiNugarker/react that referenced this pull request Apr 27, 2025
jorge-cab pushed a commit to jorge-cab/react that referenced this pull request Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants