I have this simple code at the start of my ts
file
//window.onerror = function() {
// alert('err')
//};
window.addEventListener('error', function (event) {
alert(event.message)
})
As you can see, I've tried both syntaxes.
In another function later on I have:
throw new Error('dummy err');
But the global listener does not fire
What can the issue be?
Chrome shows the the global listener to this line. but nothing happens
I am using React. Though I dont see React to be touching this
How do I ensure that all thrown errors get to my top global handler?
BTW: even regular errors, that are thrown lets say by fetch
which get back 500 errors, are also not caught by the global handler. Whats wrong?
Thanks!