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

fix(debugIds): Always instantiate global Error class in debugId injection snippet #2132

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Aug 27, 2024

This PR makes a small change to the JavaScript snippet that's injected into user files to set the debugId.

Previously, we'd instantiate new Error in the script, which usually implicitly instantiates globalThis.Error. However, if users or frameworks would create their own Error class in the very file where the debugId snippet is instantiated, new Error would of course take the user-created class rather than the global one. To fix this, this PR now explicitly instantiates the globalThis.Error class.

fixes: getsentry/sentry-javascript-bundler-plugins#593

@Lms24 Lms24 force-pushed the lms/fix-inject-snippet-global-error branch from 45d0936 to de9bfaf Compare August 27, 2024 11:14
@Lms24 Lms24 self-assigned this Aug 27, 2024
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

No objections to merging

@Lms24 Lms24 merged commit 37fc01f into master Aug 28, 2024
14 checks passed
@Lms24 Lms24 deleted the lms/fix-inject-snippet-global-error branch August 28, 2024 08:32
This was referenced Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metadata injection breaks SvelteKit error pages
3 participants