github.com/argoproj/argo-cd/v3@v3.2.1/ui/src/app/shared/components/error-boundary/error-boundary.tsx (about) 1 import * as React from 'react'; 2 3 export class ErrorBoundary extends React.Component<{message?: string}, {hasError: boolean}> { 4 constructor(props: any) { 5 super(props); 6 this.state = {hasError: false}; 7 } 8 9 static getDerivedStateFromError() { 10 return {hasError: true}; 11 } 12 13 render() { 14 if (this.state.hasError) { 15 return <h1>{this.props.message ? this.props.message : 'Something went wrong.'}</h1>; 16 } 17 18 return this.props.children; 19 } 20 }