getsentry / sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
https://sentry.io
BSD 3-Clause "New" or "Revised" License
141 stars 36 forks source link

fix(core): Always instantiate global `Error` class in injected code snippets #594

Closed Lms24 closed 2 months ago

Lms24 commented 2 months ago

This PR ensures that we always use the Error class explicitly from the global object instead of the "ambient" Error class. The reason is that users (or as reported frameworks) are free to name their own classes "Error" in which case the file injection would instantiate the user-created and not the global class.

Ref https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/593