JSFiddle - React, Tailwind, and code Playground
JavaScript
document.body.addEventListener( 'click', function () {
throw new Error( 'lol' );
});
var event = new MouseEvent( 'click' );
try {
console.log( 'one' );
document.body.dispatchEvent( event );
console.log( 'two' );
document.body.innerHTML = '<p>The event was fired, but the error bypassed the try-catch block. WTF? It\'s not asynchronous - check the console (one, error, two in Chrome and Safari; error, one, two in Firefox. Which is REALLY messed up.)</p>';
} catch ( err ) {
alert( 'The error was caught' );
}