trackEvent in ErrorBoundary, disable trackEvent in dev

This commit is contained in:
Martti Malmi
2024-01-09 15:16:47 +02:00
parent 376096c5af
commit 7073e8d9dd
3 changed files with 21 additions and 16 deletions

View File

@ -1,5 +1,7 @@
import React from "react";
import {trackEvent} from "@/Utils";
interface ErrorBoundaryState {
hasError: boolean;
errorMessage?: string;
@ -21,6 +23,7 @@ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, E
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
console.error("Caught an error:", error, errorInfo);
trackEvent("error", { error: error.message, errorInfo: JSON.stringify(errorInfo) });
}
render() {