From 66f8fde353076180276ba79d984bde60df57ab29 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 12 Oct 2022 01:54:38 +0200 Subject: [PATCH] Improve ErrorBoundary layout Now the error cause will be wrapped to prevent it from being cut off, only wrap the stacktrace in pre --- src/components/ErrorBoundary.tsx | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx index 83f35e6..c62acb0 100644 --- a/src/components/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary.tsx @@ -1,9 +1,9 @@ import Logger from "../utils/logger"; -import { Card, React } from "../webpack/common"; +import { Margins, React } from "../webpack/common"; import { ErrorCard } from "./ErrorCard"; interface Props { - fallback?: React.ComponentType>; + fallback?: React.ComponentType>; onError?(error: Error, errorInfo: React.ErrorInfo): void; } @@ -24,14 +24,23 @@ export default class ErrorBoundary extends React.Component; return ( @@ -59,9 +68,12 @@ export default class ErrorBoundary extends React.Component -
-                        {this.state.error}
-                    
+ {this.state.message} + {!!this.state.stack && ( +
+                            {this.state.stack}
+                        
+ )}
);