import React from 'react';
import Result from '../result';
import './style';
import { jsx as _jsx } from "react/jsx-runtime";
class WauErrorBoundary extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      hasError: false,
      errorInfo: ''
    };
  }
  static getDerivedStateFromError(error) {
    return {
      hasError: true,
      errorInfo: error.message
    };
  }
  componentDidCatch(error, errorInfo) {
    // You can also log the error to an error reporting service
    // eslint-disable-next-line no-console
    console.log(error, errorInfo);
  }
  render() {
    if (this.state.hasError) {
      // You can render any custom fallback UI
      return /*#__PURE__*/_jsx(Result, {
        status: "error",
        title: "Something went wrong.",
        extra: this.state.errorInfo
      });
    }
    return this.props.children;
  }
}
export default WauErrorBoundary;