Files
discord-decomp/_bundle/Module922.js
T
2026-11-01 12:12:55 +02:00

107 lines
3.5 KiB
JavaScript

// Metro module 922 (f923).
import { defineIntegration } from "./setupIntegration";
import * as _isInstanceOf from "./isInstanceOf";
import { isPlainObject } from "./isInstanceOf";
import { normalize } from "./normalize";
import { addNonEnumerableProperty } from "./addNonEnumerableProperty";
import { truncate } from "./Module832";
import { DEBUG_BUILD } from "./Module823";
import { debug } from "./consoleSandbox";
const _extractErrorData = function _extractErrorData(a0, captureErrorCause, maxValueLength) {
let r37, r40;
try {
const r39 = ["name", "message", "stack", "line", "column", "fileName", "lineNumber", "columnNumber", "toJSON"];
r40 = {};
let r42 = Object.keys(a0)[Symbol.iterator]();
const next = r42.next;
while (true) {
const r19 = r42 === void 0 ? void 0 : (r37 = next.call(r42)).done ? r42 = void 0 : r37.value;
if (r42 === void 0) {
if (captureErrorCause && a0.cause !== void 0) {
if (_isInstanceOf.isError(a0.cause)) {
const r84 = a0.cause.name || a0.cause.constructor.name;
const r87 = r40;
const cause = {};
cause[r84] = _extractErrorData(a0.cause, false, maxValueLength);
r87.cause = cause;
} else {
r40.cause = a0.cause;
}
}
if (typeof a0.toJSON !== "function") {
break;
}
const r95 = a0.toJSON();
for (const item of Object.keys(r95)) {
const r107 = r95[item];
const r109 = r40;
const isError = _isInstanceOf.isError(r107);
r109[item] = isError ? r107.toString() : r107;
}
break;
}
try {
if (r39.indexOf(r19) === -1) {
const r21 = a0[r19];
r40[r19] = !_isInstanceOf.isError(r21) && typeof r21 !== "string" ? r21 : maxValueLength ? truncate(`${r21}`, maxValueLength) : `${r21}`;
}
} catch (r69) {
if (r42 !== void 0 && typeof r42.return === "function") {
try {
r42.return();
} catch {}
}
throw r69;
}
}
} catch (r122) {
if (DEBUG_BUILD) {
debug.error("Unable to extract extra data from the Error object:", r122);
}
return null;
}
return r40;
};
Object.defineProperty(exports, Symbol.toStringTag, {
value: "Module"
});
export const extraErrorDataIntegration = defineIntegration(function(r1 = {}) {
const { depth = 3, captureErrorCause = true } = r1;
return {
name: "ExtraErrorData",
processEvent: (a0, a1, a2) => {
let r2 = a1;
const maxValueLength = a2.getOptions().maxValueLength;
if (a1 === void 0) {
r2 = {};
}
const originalException = r2.originalException;
let r19 = a0;
if (originalException) {
const isError = _isInstanceOf.isError(r2.originalException);
r19 = a0;
if (isError) {
const r24 = r2.originalException.name || r2.originalException.constructor.name;
const r29 = _extractErrorData(r2.originalException, captureErrorCause, maxValueLength);
r19 = a0;
if (r29) {
const contexts = {
...a0.contexts
};
const r35 = normalize(r29, depth);
if (isPlainObject(r35)) {
addNonEnumerableProperty(r35, "__sentry_skip_normalization__", true);
contexts[r24] = r35;
}
r19 = {
...a0,
contexts
};
}
}
}
return r19;
}
};
});