mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-10 17:34:24 +08:00
impr(dev): showing notifications with unhandled errors
This commit is contained in:
parent
a8285c068e
commit
c3f7f0de6a
1 changed files with 12 additions and 0 deletions
|
|
@ -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 ?? "",
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue