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

599 lines
24 KiB
JavaScript

/* Metro module 183; source: unknown; dependencies: [7, 6, 15, 17, 18, 162, 184, 187, 71] */
import ClassCallCheck from './module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from './module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from './module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from './module-00017.js'; /* Metro dependency 17 */
import Inherits from './module-00018-Inherits.js'; /* Metro dependency 18 */
import Module00162 from './module-00162.js'; /* Metro dependency 162 */
function _fun2623(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#2623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:6, offset: 0x00c84f05, size: 286 bytes, params: 8, frame: 19
const env0_1 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = Module00162;
const Error = global.Error;
value = value(Error);
value = _fun2630(value);
exports.default = {decoratedExtraDataKey: 'RN$ErrorExtraDataKey', handleException: handleException,
installConsoleErrorReporter: installConsoleErrorReporter, SyntheticError: value,
unstable_setExceptionDecorator: function(a0) {
env0_8 = a0;
}};
exports.SyntheticError = value;
function _isNativeReflectConstruct_2624() { // fn#2624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:148, offset: 0x00c85023, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_2624_isNativeReflectConstruct = function() {
return !!result;
})();
}
function reportException(a0, a1, a2) { // fn#2627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:800, offset: 0x00c85081, size: 663 bytes, params: 4, frame: 26
var stack;
var message;
var r6;
var r3;
var r13;
var r10;
var name;
var componentStack;
var value;
var value2;
var property;
var value3;
var value4;
var binding;
var value5;
var value6;
var HermesInternal;
var concat;
var value7;
var value8;
var value9;
var startsWith;
var value10;
var Object;
var assign;
var object;
var jsEngine;
var value11;
var cause;
var value12;
var value13;
var stackSymbols;
var stackReturnAddresses;
var stackElements;
var value14;
var error;
var console;
var type;
var RN$hasHandledFatalException;
var RN$notifyOfFatalException;
var reportException;
exceptionLanding30: while (true) {
value = environment;
value2 = undefined;
property = (require(184) /* metro dependency 184 */).default;
value3 = null;
reducibleJoin2: while (true) {
if (value3 == a0) {
stack = value2;
break reducibleJoin2;
}
stack = a0.stack;
break reducibleJoin2;
}
value4 = property(stack);
binding = env0_12;
value5 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
env0_12 = value5;
message = a0.message;
reducibleJoin4: while (true) {
if (message) {
break reducibleJoin4;
}
value6 = '';
message = value6;
break reducibleJoin4;
}
componentStack = a0.componentStack;
reducibleJoin6: while (true) {
if (value3 == componentStack) {
r6 = message;
break reducibleJoin6;
}
componentStack = a0.componentStack;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value7 = message + ('\n\nThis error is located at:' + componentStack);
r6 = value7;
break reducibleJoin6;
}
name = a0.name;
value8 = '';
reducibleJoin9: while (true) {
if (value3 == name) {
r3 = value8;
break reducibleJoin9;
}
name = a0.name;
if (value8 === name) {
r3 = value8;
break reducibleJoin9;
}
name = a0.name;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value9 = value8 + name + ': ';
r3 = value9;
break reducibleJoin9;
}
startsWith = r6.startsWith;
reducibleJoin11: while (true) {
if (Reflect.apply(startsWith, r6, [r3])) {
r13 = r6;
break reducibleJoin11;
}
value10 = r3 + r6;
r13 = value10;
break reducibleJoin11;
}
Object = global.Object;
assign = Object.assign;
property = a0[env0_11];
jsEngine = a0.jsEngine;
stack = a0.stack;
value11 = Reflect.apply(assign, Object, [{}, property, {jsEngine: jsEngine, rawStack: stack}]);
cause = a0.cause;
value12 = value3 != cause;
reducibleJoin13: while (true) {
if (value12) {
cause = a0.cause;
value13 = typeof cause === 'object';
r3 = value13;
break reducibleJoin13;
}
r3 = value12;
break reducibleJoin13;
}
reducibleJoin15: while (true) {
if (r3) {
cause = a0.cause;
stackSymbols = cause.stackSymbols;
value11.stackSymbols = stackSymbols;
cause = a0.cause;
stackReturnAddresses = cause.stackReturnAddresses;
value11.stackReturnAddresses = stackReturnAddresses;
cause = a0.cause;
stackElements = cause.stackElements;
value11.stackElements = stackElements;
break reducibleJoin15;
}
break reducibleJoin15;
}
object = {message: r13};
r10 = r13 === message ? value3 : message;
object.originalMessage = r10;
name = a0.name;
reducibleJoin19: while (true) {
if (value3 == name) {
name = value3;
break reducibleJoin19;
}
name = a0.name;
if (value8 === name) {
name = value3;
break reducibleJoin19;
}
name = a0.name;
break reducibleJoin19;
}
object.name = name;
componentStack = a0.componentStack;
reducibleJoin21: while (true) {
if (typeof componentStack !== 'string') {
componentStack = value3;
break reducibleJoin21;
}
componentStack = a0.componentStack;
break reducibleJoin21;
}
reducibleJoin32: while (true) {
reduciblePort31: while (true) {
exceptionLanding28: while (true) {
object.componentStack = componentStack;
object.stack = value4;
object.id = value5;
object.isFatal = a1;
object.extraData = value11;
if (env0_8) {
if (env0_10) {
r3 = object;
break reduciblePort31;
}
env0_10 = true;
try {
try {
binding = env0_8;
} catch (error) {
break exceptionLanding28;
}
} catch (error) {
break exceptionLanding30;
}
try {
try {
value14 = binding(object);
} catch (error) {
break exceptionLanding28;
}
} catch (error) {
break exceptionLanding30;
}
env0_10 = false;
r3 = value14;
break reduciblePort31;
}
r3 = object;
break reduciblePort31;
}
env0_10 = false;
r3 = object;
break reduciblePort31;
}
reducibleJoin33: while (true) {
if (a2) {
break reducibleJoin32;
}
break reducibleJoin33;
}
if (!a1) {
type = a0.type;
reducibleJoin35: while (true) {
if (type === 'warn') {
return value2;
}
break reducibleJoin35;
}
}
property = (require(187) /* metro dependency 187 */).default;
if (property) {
reducibleJoin42: while (true) {
reducibleJoin41: while (true) {
if (a1) {
RN$hasHandledFatalException = env0_0.RN$hasHandledFatalException;
if (value3 != RN$hasHandledFatalException) {
binding = env0_0;
RN$hasHandledFatalException = binding.RN$hasHandledFatalException;
reducibleJoin39: while (true) {
if (Reflect.apply(RN$hasHandledFatalException, binding, [])) {
return value2;
}
break reducibleJoin39;
}
}
RN$notifyOfFatalException = env0_0.RN$notifyOfFatalException;
if (value3 == RN$notifyOfFatalException) {
break reducibleJoin41;
}
binding = env0_0;
RN$notifyOfFatalException = binding.RN$notifyOfFatalException;
Reflect.apply(RN$notifyOfFatalException, binding, []);
break reducibleJoin41;
}
break reducibleJoin41;
}
reportException = property.reportException;
Reflect.apply(reportException, property, [r3]);
break reducibleJoin42;
}
}
return value2;
}
console = global.console;
error = console.error;
Reflect.apply(error, console, [a0]);
if (!a1) {
type = a0.type;
reducibleJoin35: while (true) {
if (type === 'warn') {
return value2;
}
break reducibleJoin35;
}
}
property = (require(187) /* metro dependency 187 */).default;
if (property) {
reducibleJoin42: while (true) {
reducibleJoin41: while (true) {
if (a1) {
RN$hasHandledFatalException = env0_0.RN$hasHandledFatalException;
if (value3 != RN$hasHandledFatalException) {
binding = env0_0;
RN$hasHandledFatalException = binding.RN$hasHandledFatalException;
reducibleJoin39: while (true) {
if (Reflect.apply(RN$hasHandledFatalException, binding, [])) {
return value2;
}
break reducibleJoin39;
}
}
RN$notifyOfFatalException = env0_0.RN$notifyOfFatalException;
if (value3 == RN$notifyOfFatalException) {
break reducibleJoin41;
}
binding = env0_0;
RN$notifyOfFatalException = binding.RN$notifyOfFatalException;
Reflect.apply(RN$notifyOfFatalException, binding, []);
break reducibleJoin41;
}
break reducibleJoin41;
}
reportException = property.reportException;
Reflect.apply(reportException, property, [r3]);
break reducibleJoin42;
}
}
return value2;
}
throw error;
}
function reactConsoleErrorHandler() { // fn#2628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:1846, offset: 0x00c85318, size: 351 bytes, params: 1, frame: 19
var r4;
var r3;
var value5;
var RN$inExceptionHandler;
var binding;
var property;
var stack;
var map;
var value6;
var join;
var value7;
var value8;
var binding2;
var value10;
var RN$handleException;
var message;
var startsWith;
const length = arguments.length;
const Array = global.Array;
let prototype = Array.prototype;
const value2 = Object.create(prototype, {constructor: {value: Array}});
const array = new Array(length);
const value3 = array instanceof Object ? array : value2;
const value4 = 0;
if (value4 < length) {
r4 = value4;
reducibleLoop1: while (true) {
value3[r4] = arguments[r4];
value5 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
if (value5 < length) {
r4 = value5;
continue reducibleLoop1;
}
break reducibleLoop1;
}
}
const console = global.console;
console._errorOriginal.apply(console, value3);
if (global.console.reportErrorsAsExceptions) {
reducibleJoin14: while (true) {
if (env0_13) {
break reducibleJoin14;
}
RN$inExceptionHandler = env0_0.RN$inExceptionHandler;
if (RN$inExceptionHandler != null) {
binding = env0_0;
RN$inExceptionHandler = binding.RN$inExceptionHandler;
reducibleJoin6: while (true) {
if (Reflect.apply(RN$inExceptionHandler, binding, [])) {
break reducibleJoin14;
}
break reducibleJoin6;
}
}
property = value3[value4];
reducibleJoin9: while (true) {
reducibleJoin8: while (true) {
if (property == null) {
break reducibleJoin8;
}
stack = property.stack;
if (stack) {
r3 = property;
break reducibleJoin9;
}
break reducibleJoin8;
}
var env0_0 = (require(71) /* metro dependency 71 */).default;
map = value3.map;
value6 = Reflect.apply(map, value3, [_fun2629]);
join = value6.join;
value7 = Reflect.apply(join, value6, [' ']);
binding = env0_9;
prototype = binding.prototype;
value8 = Object.create(prototype, {constructor: {value: binding}});
binding2 = new binding();
value10 = binding2 instanceof Object ? binding2 : value8;
value10.name = 'console.error';
r3 = value10;
break reducibleJoin9;
}
RN$handleException = env0_0.RN$handleException;
if (RN$handleException) {
binding = env0_0;
RN$handleException = binding.RN$handleException;
reducibleJoin11: while (true) {
if (Reflect.apply(RN$handleException, binding, [r3, false, false])) {
break reducibleJoin14;
}
break reducibleJoin11;
}
}
message = r3.message;
startsWith = message.startsWith;
if (Reflect.apply(startsWith, message, ['Warning: '])) {
return undefined;
}
reportException(r3, false, false);
break reducibleJoin14;
}
}
function _fun2629(a0) { // fn#2629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:2168, offset: 0x00c85477, size: 33 bytes, params: 2, frame: 12
var r0;
let value = a0;
if (typeof value === 'string') {
r0 = value;
} else {
value = env0_0(value);
r0 = value;
}
return r0;
}
}
function _fun2630(a0) { // fn#2630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:375, offset: 0x00c85498, size: 40 bytes, params: 2, frame: 14
const SyntheticError2 = SyntheticError;
Inherits(SyntheticError2, a0);
return CreateClass(SyntheticError2);
function SyntheticError() { // fn#2631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:387, offset: 0x00c854c0, size: 197 bytes, params: 1, frame: 20
var r1;
var r5;
var r0;
var value7;
var Reflect;
var construct;
let value = environment.__proto__;
let binding = env1_4;
binding(this, SyntheticError);
const length = arguments.length;
const Array = global.Array;
const array = new Array(length);
const value6 = 0;
if (value6 < length) {
r1 = value6;
reducibleLoop1: while (true) {
array[r1] = arguments[r1];
value7 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
if (value7 < length) {
r1 = value7;
continue reducibleLoop1;
}
break reducibleLoop1;
}
}
const value8 = [].concat(array);
const value9 = env1_6(SyntheticError);
binding = env1_5;
if (_isNativeReflectConstruct_2624()) {
Reflect = global.Reflect;
construct = Reflect.construct;
reducibleJoin6: while (true) {
if (value8) {
r5 = value8;
break reducibleJoin6;
}
r5 = [];
break reducibleJoin6;
}
r0 = Reflect.apply(construct, Reflect, [value9, r5, env1_6(this).constructor]);
} else {
r0 = value9.apply(this, value8);
}
value = binding(this, r0);
value.name = '';
return value;
}
}
function handleException(a0, a1) { // fn#2632, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:2445, offset: 0x00c85585, size: 139 bytes, params: 3, frame: 21
var r6;
var binding;
var reportExceptionBinding;
var error;
let value = a0;
const RN$handleException = env0_0.RN$handleException;
if (RN$handleException) {
binding = env0_0;
if (!binding.RN$handleException(value, a1, true)) {
if (value instanceof global.Error) {
r6 = value;
} else {
value = new env0_9(value);
r6 = value;
}
}
} else if (value instanceof global.Error) {
r6 = value;
} else {
value = new env0_9(value);
r6 = value;
}
return undefined;
try {
env0_13 = true;
} catch (error) {
env0_13 = false;
throw error;
}
try {
reportExceptionBinding = reportException;
} catch (error) {
env0_13 = false;
throw error;
}
try {
reportExceptionBinding(r6, a1, true);
} catch (error) {
env0_13 = false;
throw error;
}
}
function installConsoleErrorReporter() { // fn#2633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:208:2654, offset: 0x00c85610, size: 111 bytes, params: 1, frame: 13
var error;
let console = global.console;
if (!console._errorOriginal) {
console = global.console;
error = global.console.error;
console._errorOriginal = error.bind(global.console);
console = global.console;
console.error = reactConsoleErrorHandler;
console = global.console;
if (console.reportErrorsAsExceptions === undefined) {
global.console.reportErrorsAsExceptions = true;
}
}
}
}
global.__d(_fun2623, 183, [7, 6, 15, 17, 18, 162, 184, 187,
71]) /* metro module 183, dependencies: [7, 6, 15, 17, 18, 162, 184, 187, 71] */;