From 0c0983428b387a587dc71baed30d7a16178b3ef2 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> Date: Tue, 4 Mar 2025 12:15:10 +0100 Subject: Fix build process --- src/ErrorBoundary.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/ErrorBoundary.tsx') diff --git a/src/ErrorBoundary.tsx b/src/ErrorBoundary.tsx index d3f5a60..2372f9b 100644 --- a/src/ErrorBoundary.tsx +++ b/src/ErrorBoundary.tsx @@ -6,16 +6,23 @@ interface ErrorBoundaryProps { interface ErrorBoundaryState { hasError: boolean; + error: Error | null; } class ErrorBoundary extends Component { constructor(props: ErrorBoundaryProps) { super(props); - this.state = { hasError: false }; + this.state = { + hasError: false, + error: null + }; } - static getDerivedStateFromError(_: Error): ErrorBoundaryState { - return { hasError: true }; + static getDerivedStateFromError(error: Error): ErrorBoundaryState { + return { + hasError: true, + error + }; } componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { @@ -24,7 +31,12 @@ class ErrorBoundary extends Component { render() { if (this.state.hasError) { - return

Something went wrong.

; + return <> +

Something went wrong.

+
+          {this.state.error?.stack}
+        
+ ; } return this.props.children; -- cgit v1.3