"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SentryErrorMonitorContextProvider = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const ErrorMonitorContext_1 = require("../../common/components/ErrorHandling/ErrorMonitorContext");
const api_1 = require("../../common/api");
const utils_1 = require("../../common/api/utils");
const sentry_1 = require("../sentry");
const SentryErrorMonitorContextProvider = ({ children, }) => {
    const exceptionReporter = (error, message, severity) => {
        if ((0, utils_1.isApiError)(error)) {
            (0, api_1.handleApiError)(error);
        }
        else {
            (0, sentry_1.captureException)(error, message, severity);
        }
    };
    return (react_1.default.createElement(ErrorMonitorContext_1.ErrorMonitorContextProvider, { exceptionReporter }, children));
};
exports.SentryErrorMonitorContextProvider = SentryErrorMonitorContextProvider;
//# sourceMappingURL=SentryErrorMonitorContextProvider.js.map