Skip to content

Commit 33a9022

Browse files
committed
chore: remove duplicate console.error on rejection
1 parent a99408a commit 33a9022

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

frontend/src/ts/event-handlers/global.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as PageTransition from "../states/page-transition";
33
import Config from "../config";
44
import * as TestWords from "../test/test-words";
55
import { getCommandline } from "../utils/async-modules";
6-
import { log } from "../controllers/analytics-controller";
76
import * as Notifications from "../elements/notifications";
87

98
document.addEventListener("keydown", async (e) => {
@@ -32,8 +31,6 @@ document.addEventListener("keydown", async (e) => {
3231

3332
window.onerror = function (message, url, line, column, error): void {
3433
if (Misc.isDevEnvironment()) {
35-
//this is causing errors when using chrome responsive design dev tools
36-
if (error?.message.includes("x_magnitude")) return;
3734
Notifications.add(error?.message ?? "Undefined message", -1, {
3835
customTitle: "DEV: Unhandled error",
3936
duration: 5,
@@ -44,13 +41,14 @@ window.onerror = function (message, url, line, column, error): void {
4441

4542
window.onunhandledrejection = function (e): void {
4643
if (Misc.isDevEnvironment()) {
47-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
48-
const message = (e.reason.message ?? e.reason) as string;
49-
Notifications.add(`${message}`, -1, {
50-
customTitle: "DEV: Unhandled rejection",
51-
duration: 5,
52-
important: true,
53-
});
54-
console.error(e);
44+
Notifications.add(
45+
(e.reason as Error).message ?? e.reason ?? "Undefined message",
46+
-1,
47+
{
48+
customTitle: "DEV: Unhandled rejection",
49+
duration: 5,
50+
important: true,
51+
}
52+
);
5553
}
5654
};

0 commit comments

Comments
 (0)