aboutsummaryrefslogtreecommitdiff
path: root/src/components/ErrorBoundary.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ErrorBoundary.tsx')
-rw-r--r--src/components/ErrorBoundary.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx
index 4c2725d..870371e 100644
--- a/src/components/ErrorBoundary.tsx
+++ b/src/components/ErrorBoundary.tsx
@@ -22,8 +22,13 @@ import { Margins, React } from "../webpack/common";
import { ErrorCard } from "./ErrorCard";
interface Props {
+ /** Render nothing if an error occurs */
+ noop?: boolean;
+ /** Fallback component to render if an error occurs */
fallback?: React.ComponentType<React.PropsWithChildren<{ error: any; message: string; stack: string; }>>;
+ /** called when an error occurs */
onError?(error: Error, errorInfo: React.ErrorInfo): void;
+ /** Custom error message */
message?: string;
}
@@ -67,6 +72,8 @@ const ErrorBoundary = LazyComponent(() => {
render() {
if (this.state.error === NO_ERROR) return this.props.children;
+ if (this.props.noop) return null;
+
if (this.props.fallback)
return <this.props.fallback
children={this.props.children}