Error handler out of scope

This commit is contained in:
Dustin Brett 2025-01-20 19:57:36 -08:00
parent acc77cd878
commit 8198e0a61a

View File

@ -1,14 +1,14 @@
import { useEffect } from "react";
import { haltEvent } from "utils/functions";
const useGlobalErrorHandler = (): void => {
useEffect(() => {
const errorHandler = (event: Event & { error: Error }): void => {
if (event.error?.stack?.includes("eval at <anonymous>")) {
haltEvent(event);
}
};
const useGlobalErrorHandler = (): void => {
useEffect(() => {
window.addEventListener("error", errorHandler);
return () => window.removeEventListener("error", errorHandler);