+
+
+
+ {t("errorBoundary.title", "Something went wrong")}
+
+
+
+ {componentName && (
+
+ {t("errorBoundary.componentError", "Error in {{componentName}} component", { componentName })}
+
+ )}
+
+
+ {t(
+ "errorBoundary.description",
+ "An error occurred in this part of the interface. You can try to recover by clicking the button below.",
+ )}
+
+
+
+
+ {t("errorBoundary.showDetails", "Show error details")}
+
+
+ {error.message}
+ {error.stack && (
+ <>
+ {"\n\n"}
+ {error.stack}
+ >
+ )}
+
+
+
+
+ {t("errorBoundary.retry", "Try again")}
+
+
+ )
+}
+
+interface ErrorBoundaryProps {
+ children: React.ReactNode
+ componentName?: string
+ onError?: (error: Error, errorInfo: React.ErrorInfo) => void
+}
+
+export function ErrorBoundary({ children, componentName, onError }: ErrorBoundaryProps) {
+ const handleError = (error: Error, errorInfo: React.ErrorInfo) => {
+ // Report error using our error reporting utility
+ errorReporter.reportError(error, errorInfo, componentName)
+
+ // Call custom error handler if provided (for potential Sentry integration)
+ onError?.(error, errorInfo)
+ }
+
+ return (
+