276 lines
8.5 KiB
JavaScript
276 lines
8.5 KiB
JavaScript
// Metro module 1031 (f1032).
|
|
import { _INTERNAL_enhanceErrorWithSentryInfo, isErrorEvent, isDOMError, isDOMException, isError, isPlainObject, isEvent, addExceptionMechanism, isParameterizedString, addExceptionTypeValue, getClient, normalizeToSize, extractExceptionKeysForMessage, resolvedSyncPromise } from "./Module817";
|
|
let parseStackFrames, c846_4, extractMessage, eventFromUnknownInput;
|
|
const exceptionFromError = function exceptionFromError(a0, error) {
|
|
const frames = parseStackFrames(a0, error);
|
|
const name = error?.name;
|
|
let type = name;
|
|
if (!name) {
|
|
const WebAssembly2 = globalThis.WebAssembly;
|
|
type = (typeof WebAssembly2 !== "undefined" ? WebAssembly.Exception !== void 0 : typeof WebAssembly2 !== "undefined") && error instanceof WebAssembly.Exception ? error.message ? Array.isArray(error.message) ? error.message.length == 2 ? error.message[0] : "WebAssembly.Exception" : "WebAssembly.Exception" : "WebAssembly.Exception" : name;
|
|
}
|
|
const r32 = {
|
|
type,
|
|
value: extractMessage(error)
|
|
};
|
|
if (frames.length) {
|
|
r32.stacktrace = {
|
|
frames
|
|
};
|
|
}
|
|
if (r32.type === void 0 && r32.value === "") {
|
|
r32.value = "Unrecoverable error caught";
|
|
}
|
|
return r32;
|
|
};
|
|
parseStackFrames = function parseStackFrames(a0, a1) {
|
|
let r9;
|
|
const r4 = a1.stacktrace || a1.stack || "";
|
|
const r2 = (function getSkipFirstStackStringLines(a0) {
|
|
if (a0 && c846_4.test(a0.message)) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
})(a1);
|
|
const r7 = (function getPopFirstTopFrames(a0) {
|
|
if (typeof a0.framesToPop === "number") {
|
|
return a0.framesToPop;
|
|
}
|
|
return 0;
|
|
})(a1);
|
|
try {
|
|
r9 = a0(r4, r2, r7);
|
|
} catch ($e) {
|
|
return [];
|
|
}
|
|
return r9;
|
|
};
|
|
extractMessage = function extractMessage(a0) {
|
|
const message = a0?.message;
|
|
const WebAssembly2 = globalThis.WebAssembly;
|
|
return (typeof WebAssembly2 !== "undefined" ? WebAssembly.Exception !== void 0 : typeof WebAssembly2 !== "undefined") && a0 instanceof WebAssembly.Exception ? Array.isArray(a0.message) ? a0.message.length == 2 ? a0.message[1] : "wasm exception" : "wasm exception" : message ? message.error && typeof message.error.message === "string" ? _INTERNAL_enhanceErrorWithSentryInfo(message.error) : _INTERNAL_enhanceErrorWithSentryInfo(a0) : "No error message";
|
|
};
|
|
eventFromUnknownInput = function eventFromUnknownInput(a0, a1, a2, attachStacktrace, a4) {
|
|
let r55, r146, r183;
|
|
if (isErrorEvent(a1) && a1.error) {
|
|
return {
|
|
exception: {
|
|
values: [exceptionFromError(a0, a1.error)]
|
|
}
|
|
};
|
|
}
|
|
if (!isDOMError(a1) && !isDOMException(a1)) {
|
|
L46: {
|
|
if (isError(a1)) {
|
|
r55 = {
|
|
exception: {
|
|
values: [exceptionFromError(a0, a1)]
|
|
}
|
|
};
|
|
} else {
|
|
if (!isPlainObject(a1) && !isEvent(a1)) {
|
|
r55 = {};
|
|
if (attachStacktrace && a2) {
|
|
const frames = parseStackFrames(a0, a2);
|
|
if (frames.length) {
|
|
r55.exception = {
|
|
values: [{
|
|
value: a1,
|
|
stacktrace: {
|
|
frames
|
|
}
|
|
}]
|
|
};
|
|
}
|
|
addExceptionMechanism(r55, {
|
|
synthetic: true
|
|
});
|
|
}
|
|
if (isParameterizedString(a1)) {
|
|
r55.logentry = {
|
|
message: a1.__sentry_template_string__,
|
|
params: a1.__sentry_template_values__
|
|
};
|
|
} else {
|
|
r55.message = a1;
|
|
}
|
|
addExceptionTypeValue(r55, `${a1}`, void 0);
|
|
addExceptionMechanism(r55, {
|
|
synthetic: true
|
|
});
|
|
break L46;
|
|
}
|
|
const client = getClient();
|
|
const r91 = client == null ? void 0 : client.getOptions().normalizeDepth;
|
|
let r17 = void 0;
|
|
for (const key in a1) {
|
|
r17 = void 0;
|
|
if (Object.prototype.hasOwnProperty.call(a1, key)) {
|
|
const r100 = a1[key];
|
|
const r102 = r100 instanceof Error;
|
|
r17 = r100;
|
|
if (r102) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
r17 = void 0;
|
|
const extra = {
|
|
__serialized__: normalizeToSize(a1, r91)
|
|
};
|
|
const r108 = {
|
|
exception: null,
|
|
extra: null
|
|
};
|
|
const exception = {
|
|
values: null
|
|
};
|
|
if (r17) {
|
|
exception.values = [exceptionFromError(a0, r17)];
|
|
r108.exception = exception;
|
|
r108.extra = extra;
|
|
r146 = r108;
|
|
} else {
|
|
const type = isEvent(a1) ? a1.constructor.name : a4 ? "UnhandledRejection" : "Error";
|
|
const r121 = extractExceptionKeysForMessage(a1);
|
|
const r23 = a4 ? "promise rejection" : "exception";
|
|
exception.values = [{
|
|
type,
|
|
value: isErrorEvent(a1) ? `Event \`ErrorEvent\` captured as ${r23} with message \`${a1.message}\`` : isEvent(a1) ? `Event \`${(function getObjectClassName(a0) {
|
|
let r8;
|
|
try {
|
|
const prototypeOf = Object.getPrototypeOf(a0);
|
|
r8 = prototypeOf ? prototypeOf.constructor.name : void 0;
|
|
} catch ($e) {
|
|
return void 0;
|
|
}
|
|
return r8;
|
|
})(a1)}\` (type=${a1.type}) captured as ${r23}` : `Object captured as ${r23} with keys: ${r121}`
|
|
}];
|
|
r108.exception = exception;
|
|
r108.extra = extra;
|
|
r146 = r108;
|
|
if (a2) {
|
|
const frames2 = parseStackFrames(a0, a2);
|
|
const length = frames2.length;
|
|
r146 = r108;
|
|
if (length) {
|
|
r108.exception.values[0].stacktrace = {
|
|
frames: frames2
|
|
};
|
|
r146 = r108;
|
|
}
|
|
}
|
|
}
|
|
addExceptionMechanism(r146, {
|
|
synthetic: true
|
|
});
|
|
r55 = r146;
|
|
}
|
|
}
|
|
return r55;
|
|
}
|
|
if ("stack" in a1) {
|
|
r183 = {
|
|
exception: {
|
|
values: [exceptionFromError(a0, a1)]
|
|
}
|
|
};
|
|
} else {
|
|
const r169 = a1.name || (isDOMError(a1) ? "DOMError" : "DOMException");
|
|
const value = a1.message ? `${r169}: ${a1.message}` : r169;
|
|
r183 = {};
|
|
if (attachStacktrace && a2) {
|
|
const frames3 = parseStackFrames(a0, a2);
|
|
if (frames3.length) {
|
|
r183.exception = {
|
|
values: [{
|
|
value,
|
|
stacktrace: {
|
|
frames: frames3
|
|
}
|
|
}]
|
|
};
|
|
}
|
|
addExceptionMechanism(r183, {
|
|
synthetic: true
|
|
});
|
|
}
|
|
if (isParameterizedString(value)) {
|
|
r183.logentry = {
|
|
message: value.__sentry_template_string__,
|
|
params: value.__sentry_template_values__
|
|
};
|
|
} else {
|
|
r183.message = value;
|
|
}
|
|
addExceptionTypeValue(r183, value);
|
|
}
|
|
if ("code" in a1) {
|
|
r183.tags = {
|
|
...r183.tags,
|
|
"DOMException.code": `${a1.code}`
|
|
};
|
|
}
|
|
return r183;
|
|
};
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
c846_4 = /Minified React error #\d+;/i;
|
|
export function eventFromException(a0, a1, a2, a3) {
|
|
const r5 = eventFromUnknownInput(a0, a1, a2?.syntheticException || void 0, a3);
|
|
addExceptionMechanism(r5);
|
|
r5.level = "error";
|
|
if (a2?.event_id) {
|
|
r5.event_id = a2.event_id;
|
|
}
|
|
return resolvedSyncPromise(r5);
|
|
}
|
|
export function eventFromMessage(a0, a1, level = "info", r6) {
|
|
const r10 = r6?.syntheticException || void 0;
|
|
const r4 = arguments[4];
|
|
const r5 = {};
|
|
if (r4 && r10) {
|
|
const frames = parseStackFrames(a0, r10);
|
|
if (frames.length) {
|
|
r5.exception = {
|
|
values: [{
|
|
value: a1,
|
|
stacktrace: {
|
|
frames
|
|
}
|
|
}]
|
|
};
|
|
}
|
|
addExceptionMechanism(r5, {
|
|
synthetic: true
|
|
});
|
|
}
|
|
if (isParameterizedString(a1)) {
|
|
r5.logentry = {
|
|
message: a1.__sentry_template_string__,
|
|
params: a1.__sentry_template_values__
|
|
};
|
|
} else {
|
|
r5.message = a1;
|
|
}
|
|
r5.level = level;
|
|
if (r6?.event_id) {
|
|
r5.event_id = r6.event_id;
|
|
}
|
|
return resolvedSyncPromise(r5);
|
|
}
|
|
export { eventFromUnknownInput };
|
|
export { exceptionFromError };
|
|
export { extractMessage };
|
|
export function extractType(a0) {
|
|
const name = a0?.name;
|
|
let r3 = name;
|
|
if (!name) {
|
|
const WebAssembly2 = globalThis.WebAssembly;
|
|
r3 = (typeof WebAssembly2 !== "undefined" ? WebAssembly.Exception !== void 0 : typeof WebAssembly2 !== "undefined") && a0 instanceof WebAssembly.Exception ? a0.message ? Array.isArray(a0.message) ? a0.message.length == 2 ? a0.message[0] : "WebAssembly.Exception" : "WebAssembly.Exception" : "WebAssembly.Exception" : name;
|
|
}
|
|
return r3;
|
|
}
|