Skip to content

Commit

Permalink
impr(dev): showing notifications with unhandled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Miodec committed Feb 25, 2024
1 parent a8285c0 commit c3f7f0d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions frontend/src/ts/ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? "",
});
Expand Down

0 comments on commit c3f7f0d

Please sign in to comment.