UNPKG

@embrace-io/web-sdk

Version:
35 lines (34 loc) 1.26 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs"); const require_constants_attributes = require("../../../../constants/attributes.cjs"); const require_api_logs_logAPI = require("../../../../api-logs/logAPI.cjs"); let react = require("react"); react = require_runtime.__toESM(react, 1); //#region src/instrumentations/exceptions/react/EmbraceErrorBoundary/EmbraceErrorBoundary.ts var EmbraceErrorBoundary = class extends react.Component { _logManager; constructor(props) { super(props); this._logManager = require_api_logs_logAPI.log.getLogManager(); this.state = { hasError: false }; } static getDerivedStateFromError() { return { hasError: true }; } componentDidCatch(error, errorInfo) { this._logManager.logException(error, { handled: false, attributes: { "react.component_stack": errorInfo.componentStack ?? void 0, [require_constants_attributes.KEY_EMB_INSTRUMENTATION]: "react_error_boundary" } }); } render() { if (this.state.hasError) return this.props.fallback(); return this.props.children; } }; //#endregion exports.EmbraceErrorBoundary = EmbraceErrorBoundary; //# sourceMappingURL=EmbraceErrorBoundary.cjs.map