144 lines
3.9 KiB
JavaScript
144 lines
3.9 KiB
JavaScript
// Metro module 6428 (f6429).
|
|
import { extractExceptionKeysForMessage } from "./addNonEnumerableProperty_6374";
|
|
import { isParameterizedString, isError, isPlainObject, isErrorEvent } from "./isInstanceOf_6375";
|
|
import { normalizeToSize } from "./normalize_6413";
|
|
import { addExceptionMechanism, addExceptionTypeValue } from "./Module6379";
|
|
export function eventFromMessage(a0, a1, level = "info", r5) {
|
|
const event_id = r5 && r5.event_id;
|
|
const r6 = arguments[4];
|
|
const r2 = {
|
|
event_id,
|
|
level
|
|
};
|
|
if (r6 && r5 && r5.syntheticException) {
|
|
const frames = a0(r5.syntheticException.stack || "", 1);
|
|
if (frames.length) {
|
|
r2.exception = {
|
|
values: [{
|
|
value: a1,
|
|
stacktrace: {
|
|
frames
|
|
}
|
|
}]
|
|
};
|
|
addExceptionMechanism(r2, {
|
|
synthetic: true
|
|
});
|
|
}
|
|
}
|
|
if (isParameterizedString(a1)) {
|
|
r2.logentry = {
|
|
message: a1.__sentry_template_string__,
|
|
params: a1.__sentry_template_values__
|
|
};
|
|
return r2;
|
|
}
|
|
r2.message = a1;
|
|
return r2;
|
|
}
|
|
export function eventFromUnknownInput(a0, a1, a2, a3) {
|
|
let r40, message;
|
|
const r9 = (a3 ? a3.data : a3) && a3.data.mechanism || {
|
|
handled: true,
|
|
type: "generic"
|
|
};
|
|
if (isError(a2)) {
|
|
r40 = [a2, void 0];
|
|
} else {
|
|
r9.synthetic = true;
|
|
if (isPlainObject(a2)) {
|
|
const r48 = {
|
|
__serialized__: normalizeToSize(a2, a0 ? a0.getOptions().normalizeDepth : a0)
|
|
};
|
|
let r51 = void 0;
|
|
for (const key in a2) {
|
|
r51 = void 0;
|
|
if (Object.prototype.hasOwnProperty.call(a2, key)) {
|
|
const r56 = a2[key];
|
|
const r58 = r56 instanceof Error;
|
|
r51 = r56;
|
|
if (r58) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
r51 = void 0;
|
|
if (r51) {
|
|
r40 = [r51, r48];
|
|
} else {
|
|
if ("name" in a2 && typeof a2.name === "string") {
|
|
const r96 = `'${a2.name}' captured as exception`;
|
|
message = "message" in a2 && typeof a2.message === "string" ? r96 + ` with message '${a2.message}'` : r96;
|
|
} else if ("message" in a2 && typeof a2.message === "string") {
|
|
message = a2.message;
|
|
} else {
|
|
const r70 = extractExceptionKeysForMessage(a2);
|
|
if (isErrorEvent(a2)) {
|
|
message = `Event \`ErrorEvent\` captured as exception with message \`${a2.message}\``;
|
|
} else {
|
|
const r76 = (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;
|
|
})(a2);
|
|
message = `${r76 ? r76 !== "Object" ? `'${r76}'` : "Object" : "Object"} captured as exception with keys: ${r70}`;
|
|
}
|
|
}
|
|
const r106 = (a3 ? a3.syntheticException : a3) || new Error(message);
|
|
r106.message = message;
|
|
r40 = [r106, r48];
|
|
}
|
|
} else {
|
|
const r31 = (a3 ? a3.syntheticException : a3) || new Error(a2);
|
|
r31.message = `${a2}`;
|
|
r40 = [r31, void 0];
|
|
}
|
|
}
|
|
const [r118, extra] = r40;
|
|
const r122 = {
|
|
type: r118.name || r118.constructor.name,
|
|
value: r118.message
|
|
};
|
|
const frames = a1(r118.stack || "", 1);
|
|
if (frames.length) {
|
|
r122.stacktrace = {
|
|
frames
|
|
};
|
|
}
|
|
const r132 = {
|
|
exception: {
|
|
values: [r122]
|
|
}
|
|
};
|
|
if (extra) {
|
|
r132.extra = extra;
|
|
}
|
|
addExceptionTypeValue(r132, void 0, void 0);
|
|
addExceptionMechanism(r132, r9);
|
|
return {
|
|
...r132,
|
|
event_id: a3 ? a3.event_id : a3
|
|
};
|
|
}
|
|
export function exceptionFromError(a0, a1) {
|
|
const r5 = {
|
|
type: a1.name || a1.constructor.name,
|
|
value: a1.message
|
|
};
|
|
const frames = a0(a1.stack || "", 1);
|
|
if (frames.length) {
|
|
r5.stacktrace = {
|
|
frames
|
|
};
|
|
}
|
|
return r5;
|
|
}
|
|
export function parseStackFrames(a0, a1) {
|
|
return a0(a1.stack || "", 1);
|
|
}
|