"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
class ErrorBoundary extends react_1.default.Component {
    constructor(props) {
        super(props);
        this.state = { hasError: false };
    }
    componentDidCatch(error, errorInfo) {
        // Display fallback UI
        this.setState({ hasError: true });
        // // From https://sentry.io/onboarding/polymath-y0/issuer/configure/javascript-react
        // Sentry.withScope(scope => {
        //   Object.keys(errorInfo).forEach(key => {
        //     scope.setExtra(key, errorInfo[key]);
        //   });
        //   Sentry.captureException(error);
        // });
    }
    render() {
        if (this.state.hasError) {
            return (react_1.default.createElement("div", null,
                react_1.default.createElement("h1", null, "Aw, Snap!")));
        }
        return this.props.children;
    }
}
exports.ErrorBoundary = ErrorBoundary;
//# sourceMappingURL=ErrorBoundary.js.map