Files
discord-decomp/sources/by-id/module-01031-nativeLinkedErrorsIntegration.js
T
2026-07-28 01:06:53 +03:00

217 lines
11 KiB
JavaScript

/* Metro module 1031; source: unknown; dependencies: [65, 826, 1032, 1009] */
import Module00065 from './module-00065.js'; /* Metro dependency 65 */
import * as Module01009Module from './module-01009.js'; /* Metro dependency 1009 */
function _fun10757(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#10757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:6, offset: 0x00d953ea, size: 108 bytes, params: 8, frame: 17
let env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.nativeLinkedErrorsIntegration = function() {
var r0;
var env0_0 = (arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}).key || 'cause';
r0 = r0.limit || 5;
var env0_1 = r0;
return {name: 'NativeLinkedErrors', setupOnce: _fun10764, preprocessEvent: _fun10765};
};
function walkErrorTree(a0, a1, a2, a3) { // fn#10758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:106, offset: 0x00d95456, size: 501 bytes, params: 5, frame: 29
var name;
var message;
var appleDebugImages;
var r14;
var object;
var moduleValue;
var moduleValue2;
var isPlainObject2;
var value5;
var value6;
var appleException;
var value7;
var walkErrorTreeBinding;
var value9;
const value = undefined;
const r2 = arguments.length > 4 && value !== arguments[4] ? arguments[4] : [];
const r1 = arguments.length > 5 && value !== arguments[5] ? arguments[5] : [];
const property = a2[a3];
if (property) {
if (r2.length + 1 >= a1) {
return {exceptions: r2, debugImages: r1};
}
moduleValue = require(826) /* metro dependency 826 */;
if (moduleValue.isString(property)) {
appleDebugImages = value;
walkErrorTreeBinding = walkErrorTree;
value9 = [].concat(Module00065(r2), [{value: property}]);
object = [];
return walkErrorTreeBinding(a0, a1, property, a3, value9, object.concat(Module00065(r1),
Module00065(appleDebugImages || [])));
}
if ('stackElements' in property) {
value7 = exceptionFromJavaStackElements(property);
appleDebugImages = value;
r14 = value7;
walkErrorTreeBinding = walkErrorTree;
value9 = [].concat(Module00065(r2), [r14]);
object = [];
return walkErrorTreeBinding(a0, a1, property, a3, value9, object.concat(Module00065(r1),
Module00065(appleDebugImages || [])));
}
if ('stackReturnAddresses' in property) {
value6 = exceptionFromAppleStackReturnAddresses(property);
appleException = value6.appleException;
appleDebugImages = value6.appleDebugImages;
r14 = appleException;
walkErrorTreeBinding = walkErrorTree;
value9 = [].concat(Module00065(r2), [r14]);
object = [];
return walkErrorTreeBinding(a0, a1, property, a3, value9, object.concat(Module00065(r1),
Module00065(appleDebugImages || [])));
}
moduleValue2 = require(826) /* metro dependency 826 */;
if (moduleValue2.isInstanceOf(property, global.Error)) {
value5 = (require(1032) /* metro dependency 1032 */).exceptionFromError(a0, a2[a3]);
appleDebugImages = value;
r14 = value5;
walkErrorTreeBinding = walkErrorTree;
value9 = [].concat(Module00065(r2), [r14]);
object = [];
return walkErrorTreeBinding(a0, a1, property, a3, value9, object.concat(Module00065(r1),
Module00065(appleDebugImages || [])));
}
isPlainObject2 = (require(826) /* metro dependency 826 */).isPlainObject(property);
object = {};
if (isPlainObject2) {
name = property.name;
name = typeof name !== 'string' ? value : property.name;
object.type = name;
message = property.message;
message = typeof message !== 'string' ? value : property.message;
object.value = message;
appleDebugImages = value;
r14 = object;
walkErrorTreeBinding = walkErrorTree;
value9 = [].concat(Module00065(r2), [r14]);
object = [];
return walkErrorTreeBinding(a0, a1, property, a3, value9, object.concat(Module00065(r1),
Module00065(appleDebugImages || [])));
}
object.exceptions = r2;
object.debugImages = r1;
return object;
}
return {exceptions: r2, debugImages: r1};
function exceptionFromJavaStackElements({name, message, stackElements}) { // fn#10759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:394, owner: walkErrorTree.exceptionFromJavaStackElements, offset: 0x00d9564b, size: 87 bytes, params: 2, frame: 13
var environment;
const value = environment.__proto__;
const env0_0 = fetchNativePackage();
const object = {};
object.type = name;
object.value = message;
const object2 = {};
object2.frames = stackElements.map(_fun10760).reverse();
object.stacktrace = object2;
return object;
function _fun10760(a0) { // fn#10760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:539, offset: 0x00d956a2, size: 130 bytes, params: 2, frame: 14
const object = {platform: 'java'};
object.module = a0.className;
object.filename = a0.fileName;
let lineNumber = a0.lineNumber;
const value = undefined;
lineNumber = lineNumber >= 0 ? a0.lineNumber : value;
object.lineno = lineNumber;
object.function = a0.methodName;
const r3 = env0_0 === null || !a0.className.startsWith(env0_0);
object.in_app = r3 ? value : !r3;
return object;
}
}
function exceptionFromAppleStackReturnAddresses({stackReturnAddresses, name, message}) { // fn#10761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:795, owner: walkErrorTree.exceptionFromAppleStackReturnAddresses, offset: 0x00d95724, size: 155 bytes, params: 2, frame: 17
let value = environment.__proto__;
value = undefined;
const NATIVE = (Module01009Module).NATIVE;
const nativeStackFramesBy = NATIVE.fetchNativeStackFramesBy(stackReturnAddresses);
const object2 = {};
object2.type = name;
object2.value = message;
let r6 = nativeStackFramesBy == null ? value : nativeStackFramesBy.frames.reverse();
r6 = !r6 ? [] : r6;
object2.stacktrace = {frames: r6};
return {appleException: object2,
appleDebugImages: (nativeStackFramesBy == null ? value : nativeStackFramesBy.debugMetaImages) || []};
}
}
function fetchNativePackage() { // fn#10762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:1510, offset: 0x00d957bf, size: 61 bytes, params: 1, frame: 12
env0_3 = env0_3 === null ? (require(1009) /* metro dependency 1009 */).NATIVE.fetchNativePackageName() : env0_3;
return env0_3;
}
function nativeLinkedErrorsIntegration() { // fn#10763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:1635, offset: 0x00d957fc, size: 96 bytes, params: 1, frame: 5
const r0 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (r0.key) {
}
if (r0.limit) {
}
return {name: 'NativeLinkedErrors', setupOnce: function() {
}, preprocessEvent: preprocessEvent_10765};
function nativeLinkedErrorsIntegrationPreprocessEvent(a0, a1, a2) { // fn#10765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1158:1852, owner: nativeLinkedErrorsIntegration.preprocessEvent, offset: 0x00d9585c, size: 314 bytes, params: 4, frame: 22
var r3;
var value2;
var moduleValue;
var value3;
var exceptions;
var debugImages;
var items2;
var concat;
var binding;
var debug_meta;
var images;
var push;
var apply;
const limitBinding = limit;
const keyBinding = key;
let exception = a0.exception;
const value = undefined;
if (exception === null || value === exception ? value : exception.values) {
if (a1) {
value2 = environment.__proto__;
moduleValue = require(826) /* metro dependency 826 */;
if (moduleValue.isInstanceOf(a1.originalException, global.Error)) {
value3 = walkErrorTree(a2.getOptions().stackParser, limitBinding, a1.originalException, keyBinding);
exceptions = value3.exceptions;
debugImages = value3.debugImages;
exception = a0.exception;
items2 = [];
concat = items2.concat;
binding = env1_2;
exception.values = Reflect.apply(concat, items2, [binding(a0.exception.values), env1_2(exceptions)]);
debug_meta = a0.debug_meta;
r3 = debug_meta || ({});
a0.debug_meta = r3;
debug_meta = a0.debug_meta;
images = a0.debug_meta.images;
r3 = images || [];
debug_meta.images = r3;
debug_meta = a0.debug_meta;
images = debug_meta.images;
push = images.push;
apply = push.apply;
binding = env1_2;
Reflect.apply(apply, push, [images, binding(debugImages || [])]);
}
}
}
return value;
}
}
}
function nativeLinkedErrorsIntegrationSetupOnce() { // fn#10764, owner: nativeLinkedErrorsIntegration.setupOnce, offset: 0x00c37b63, size: 4 bytes, params: 1, frame: 1
}
global.__d(_fun10757, 1031, [65, 826, 1032, 1009]) /* metro module 1031, dependencies: [65, 826, 1032, 1009] */;