Reasoning behind using window.onerror over window.addEventListener('error') #5786
-
Yesterday our Sentry reporting stopped working for uncaught exceptions as someone had added a Why isn't Sentry using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hey! Super interesting question. I asked this to @kamilogorek on our internal slack, and I'll summarize his answer here:
Mainly, these use cases are so that we can access the event listener after they have been set, for things like our async loader. // fails
window.addEventListener('error', () => {})
console.log(window.onerror) // works
window.onerror = () => {}
console.log(window.onerror) In addition, |
Beta Was this translation helpful? Give feedback.
Hey! Super interesting question. I asked this to @kamilogorek on our internal slack, and I'll summarize his answer here:
Mainly, these use cases are so that we can access the event listener after they have been set, for things like our async loader.