108 lines
2.6 KiB
JavaScript
108 lines
2.6 KiB
JavaScript
// Metro module 1137 (f1138).
|
|
import { version } from "react";
|
|
import { isError } from "./Module817";
|
|
import { withScope, captureException } from "./Module1024";
|
|
function $mk68179($env) {
|
|
return function recurse(a0, a1) {
|
|
let r0;
|
|
const r3 = $env;
|
|
const r6 = r3[0];
|
|
if (r6.has(a0)) {
|
|
return void 0;
|
|
}
|
|
if (a0.cause) {
|
|
r6.add(a0);
|
|
r0 = (0, r3[1])(a0.cause, a1);
|
|
} else {
|
|
a0.cause = a1;
|
|
r0 = void 0;
|
|
}
|
|
return r0;
|
|
};
|
|
}
|
|
const captureReactException = function captureReactException(a0, a1, c12825_2) {
|
|
let c12825_0 = a0;
|
|
const componentStack = a1.componentStack;
|
|
const r18 = version.match(/^([^.]+)/);
|
|
if (r18 !== null && parseInt(r18[0]) >= 17 && isError(a0) && componentStack) {
|
|
let env12826;
|
|
const error = new Error(a0.message);
|
|
error.name = `React ErrorBoundary ${a0.name}`;
|
|
error.stack = componentStack;
|
|
const r39 = env12826 = {};
|
|
env12826[0] = void 0;
|
|
const weakSet = new WeakSet();
|
|
env12826[0] = weakSet;
|
|
const r45 = $mk68179(r39);
|
|
env12826[1] = r45;
|
|
if (!weakSet.has(a0)) {
|
|
if (a0.cause) {
|
|
weakSet.add(a0);
|
|
const cause = a0.cause;
|
|
if (!weakSet.has(cause)) {
|
|
if (cause.cause) {
|
|
weakSet.add(cause);
|
|
r45(cause.cause, error);
|
|
} else {
|
|
cause.cause = error;
|
|
}
|
|
}
|
|
} else {
|
|
a0.cause = error;
|
|
}
|
|
}
|
|
}
|
|
return withScope((a0) => {
|
|
a0.setContext("react", {
|
|
componentStack
|
|
});
|
|
return captureException(c12825_0, c12825_2);
|
|
});
|
|
};
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
export { captureReactException };
|
|
export function isAtLeastReact17(a0) {
|
|
const r6 = a0.match(/^([^.]+)/);
|
|
return r6 !== null && parseInt(r6[0]) >= 17;
|
|
}
|
|
export function reactErrorHandler(c12827_0) {
|
|
return (a0, a1) => {
|
|
const handled = !!c12827_0;
|
|
const r11 = captureReactException(a0, a1, {
|
|
mechanism: {
|
|
handled,
|
|
type: "auto.function.react.error_handler"
|
|
}
|
|
});
|
|
if (handled) {
|
|
c12827_0(a0, a1, r11);
|
|
}
|
|
};
|
|
}
|
|
export function setCause(a0, a1) {
|
|
let env12824;
|
|
const r2 = env12824 = {};
|
|
const weakSet = new WeakSet();
|
|
env12824[0] = weakSet;
|
|
const r11 = $mk68179(r2);
|
|
env12824[1] = r11;
|
|
if (!weakSet.has(a0)) {
|
|
if (a0.cause) {
|
|
weakSet.add(a0);
|
|
const cause = a0.cause;
|
|
if (!weakSet.has(cause)) {
|
|
if (cause.cause) {
|
|
weakSet.add(cause);
|
|
r11(cause.cause, a1);
|
|
} else {
|
|
cause.cause = a1;
|
|
}
|
|
}
|
|
} else {
|
|
a0.cause = a1;
|
|
}
|
|
}
|
|
}
|