diff --git a/applicationinsights-react-js/src/AppInsightsErrorBoundary.tsx b/applicationinsights-react-js/src/AppInsightsErrorBoundary.tsx index 2645968..856b032 100644 --- a/applicationinsights-react-js/src/AppInsightsErrorBoundary.tsx +++ b/applicationinsights-react-js/src/AppInsightsErrorBoundary.tsx @@ -13,13 +13,19 @@ export interface IAppInsightsErrorBoundaryProps { export interface IAppInsightsErrorBoundaryState { hasError: boolean + error: Error | null; + errorInfo: React.ErrorInfo | null; } export default class AppInsightsErrorBoundary extends React.Component { - state = { hasError: false }; + state: IAppInsightsErrorBoundaryState = { + hasError: false, + error: null, + errorInfo: null, + }; componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { - this.setState({ hasError: true }); + this.setState({ hasError: true, error, errorInfo }); this.props.appInsights.trackException({ error: error, exception: error, @@ -29,11 +35,14 @@ export default class AppInsightsErrorBoundary extends React.Component