diff --git a/ui/src/app/app.tsx b/ui/src/app/app.tsx index e0cdb4ee37ed2..52972f616bc09 100644 --- a/ui/src/app/app.tsx +++ b/ui/src/app/app.tsx @@ -74,19 +74,23 @@ requests.onError.subscribe(async (err) => { } }); -export class App extends React.Component<{}, { popupProps: PopupProps }> { +export class App extends React.Component<{}, { popupProps: PopupProps, error: Error }> { public static childContextTypes = { history: PropTypes.object, apis: PropTypes.object, }; + public static getDerivedStateFromError(error: Error) { + return { error }; + } + private popupManager: PopupManager; private notificationsManager: NotificationsManager; private navigationManager: NavigationManager; constructor(props: {}) { super(props); - this.state = { popupProps: null }; + this.state = { popupProps: null, error: null }; this.popupManager = new PopupManager(); this.notificationsManager = new NotificationsManager(); this.navigationManager = new NavigationManager(history); @@ -97,6 +101,20 @@ export class App extends React.Component<{}, { popupProps: PopupProps }> { } public render() { + if (this.state.error != null) { + const stack = this.state.error.stack; + const url = 'https://github.com/argoproj/argo-cd/issues/new?labels=bug&template=bug_report.md'; + + return ( + +

Something went wrong!

+

Consider submitting an issue here.


+

Stacktrace:

+
{stack}
+
+ ); + } + return (