"use strict";
/* @flow */
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const withStyles_1 = __importDefault(require("components/hoc/withStyles"));
const styles_1 = __importDefault(require("./styles"));
class ErrorBoundary extends react_1.Component {
    constructor() {
        super(...arguments);
        this.state = {
            hasError: false,
        };
    }
    componentDidCatch(error, info) {
        // Display fallback UI
        this.setState({ hasError: true });
    }
    render() {
        const { classes } = this.props;
        if (this.state.hasError) {
            // You can render any custom fallback UI
            return (react_1.default.createElement("div", { className: classes.component },
                react_1.default.createElement("h1", { className: classes.message }, "Something went wrong.")));
        }
        return this.props.children;
    }
}
exports.default = withStyles_1.default(styles_1.default)(ErrorBoundary);
//# sourceMappingURL=index.js.map