import React from 'react' ; import { withRouter } from 'react-router-dom' ; import Sentry from '@/utils/sentry' ; type Props = any ; type State = { hasError : boolean ; } ; class ErrorBoundary extends React . Component < Props , State > { constructor ( props ) { super ( props ) ; this . state = { hasError : false } ; } static getDerivedStateFromError ( ) { return { hasError : true } ; } componentDidCatch ( error , errorInfo ) { this . props . history . push ( '/error' ) ; } render ( ) { return this . props . children ; } } export default withRouter ( ErrorBoundary ) ;