refactor: add error logging to analytics

This commit is contained in:
Miodec 2023-09-28 12:32:14 +01:00
parent e0bb96e008
commit 6667fe53ba

View file

@ -12,6 +12,7 @@ import { Workbox } from "workbox-window";
import * as FunboxList from "./test/funbox/funbox-list";
//@ts-ignore
import Konami from "konami";
import { log } from "./controllers/analytics-controller";
if (Misc.isLocalhost()) {
$("footer .currentVersion .text").text("localhost");
@ -141,3 +142,15 @@ if ("serviceWorker" in navigator) {
}
});
}
window.onerror = function (message, url, line, column, error): void {
log("error", {
error: error?.stack ?? "",
});
};
window.onunhandledrejection = function (e): void {
log("error", {
error: e.reason.stack ?? "",
});
};