import { Result } from "antd" ; import React , { ReactNode } from "react" ; import * as Sentry from "@sentry/node" ; interface EBState { hasError : boolean ; } export class ErrorBoundary extends React . Component < { } , EBState > { constructor ( props ) { super ( props ) ; this . state = { hasError : false } ; } static getDerivedStateFromError ( error ) { return { hasError : true } ; } componentDidCatch ( error , errorInfo ) { if ( window ) { Sentry . captureException ( error ) ; } } render ( ) { if ( this . state . hasError ) { return ( < Result status = "500" title = "We hit an unexpected error." subTitle = "Sorry about that! A report has automatically been filed. Try refreshing the page." / > ) ; } return this . props . children ; } }