How to Deal with Unhandled Exceptions in JavaScript
The following code shows how you might create and report an error, and how it may be caught by adding a listener for the error
event.
Reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event
window.addEventListener('error', (event) => {