componentDidCatch()

in packages/react/alfa-react/src/components/ErrorBoundary/index.tsx [35:46]


  componentDidCatch(error: Error, errorInfo: ErrorInfo) {
    const { appDidCatch, logger } = this.props;

    // Display fallback UI
    this.setState({ hasError: true, error });

    isFunction((window as GlobalBl)?.__bl?.error) && (window as GlobalBl)?.__bl?.error(error, errorInfo);

    // You can also log the error to an error reporting service in appDidCatch
    appDidCatch && appDidCatch(error, errorInfo);
    logger?.error && logger.error({ E_CODE: 'RuntimeError', E_MSG: error.message, E_STACK: error, C_STACK: errorInfo });
  }