aboutsummaryrefslogtreecommitdiff
path: root/src/components/ErrorBoundary.tsx
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-11-12 15:09:02 +0100
committerVendicated <vendicated@riseup.net>2022-11-12 17:20:19 +0100
commit81edc1407071c6c0328f40a1ee487ea0388b9a7e (patch)
tree42c54ab94a58d9ffd5a2b201cfe9539a158386e4 /src/components/ErrorBoundary.tsx
parentb48c8d8a4a003ffe4bdee4c3ba3ae6f54ce1f317 (diff)
downloadVencord-81edc1407071c6c0328f40a1ee487ea0388b9a7e.tar.gz
Vencord-81edc1407071c6c0328f40a1ee487ea0388b9a7e.tar.bz2
Vencord-81edc1407071c6c0328f40a1ee487ea0388b9a7e.zip
fix PronounDB crash with new profile in dms, force start dependencies
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}