window.addEventListener('error', function(event) {
  alert("RUNTIME ERROR:\n" + event.message + "\nat " + event.filename + ":" + event.lineno);
});
window.addEventListener('unhandledrejection', function(event) {
  alert("PROMISE REJECTION:\n" + (event.reason ? event.reason.stack || event.reason : "Unknown reason"));
});
console.log("Global error logger active.");
