impr(dev): showing notifications with unhandled errors

This commit is contained in:
Miodec 2024-02-23 17:18:54 +01:00
parent a8285c068e
commit c3f7f0de6a

View file

@ -105,12 +105,24 @@ $(document).ready(() => {
});
window.onerror = function (message, url, line, column, error): void {
if (Misc.isDevEnvironment()) {
Notifications.add(error?.message ?? "Undefined message", -1, {
customTitle: "DEV: Unhandled error",
duration: 5,
});
}
void log("error", {
error: error?.stack ?? "",
});
};
window.onunhandledrejection = function (e): void {
if (Misc.isDevEnvironment()) {
Notifications.add(e.reason.message, -1, {
customTitle: "DEV: Unhandled rejection",
duration: 5,
});
}
void log("error", {
error: e.reason.stack ?? "",
});