decord/source/1054__getUnhandledRejectionError.js

174 lines
6.7 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1054
2026-07-25 08:10:48 +00:00
// Function ID: 11300
2026-07-20 16:05:17 +00:00
// Name: _getUnhandledRejectionError
2026-07-23 10:11:24 +00:00
// Dependencies: [794, 1004, 1007, 1048]
2026-07-20 16:05:17 +00:00
// Module 1054 (_getUnhandledRejectionError)
2026-07-23 10:11:24 +00:00
import registerSpanErrorInstrumentation from "registerSpanErrorInstrumentation";
2026-07-20 16:05:17 +00:00
function _getUnhandledRejectionError(arg0) {
if (obj.isPrimitive(arg0)) {
return arg0;
} else if ("reason" in tmp) {
return tmp.reason;
} else if ("detail" in tmp) {
if ("reason" in tmp.detail) {
return tmp.detail.reason;
}
}
}
function _eventFromRejectionWithPrimitive(reason) {
let obj = {};
obj = {};
obj = { type: "UnhandledRejection", value: "Non-Error promise rejection captured with value: " + String(reason) };
const items = [obj];
obj.values = items;
obj.exception = obj;
return obj;
}
function globalHandlerLog(arg0) {
2026-07-23 10:11:24 +00:00
if (require(1048).DEBUG_BUILD) {
const debug = require(794) /* registerSpanErrorInstrumentation */.debug;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
debug.log("Global Handler attached: " + arg0);
}
}
function getOptions() {
let options;
2026-07-23 10:11:24 +00:00
let obj = require(794) /* registerSpanErrorInstrumentation */;
2026-07-20 16:05:17 +00:00
const client = obj.getClient();
if (null != client) {
options = client.getOptions();
}
if (!options) {
obj = {
stackParser(stack, arg1, arg2) {
return [];
},
attachStacktrace: false
};
options = obj;
}
return options;
}
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
export { _eventFromRejectionWithPrimitive };
export { _getUnhandledRejectionError };
2026-07-23 10:11:24 +00:00
export const globalHandlersIntegration = registerSpanErrorInstrumentation.defineIntegration(function _globalHandlersIntegration() {
2026-07-20 16:05:17 +00:00
if (arguments.length > 0) {
if (undefined !== arguments[0]) {
const first = arguments[0];
}
const _Object = Object;
2026-07-23 10:11:24 +00:00
let closure_0 = Object.assign({ onerror: true, onunhandledrejection: true }, {});
let obj = {
2026-07-20 16:05:17 +00:00
name: "GlobalHandlers",
setupOnce() {
Error.stackTraceLimit = 50;
},
setup(arg0) {
if (closure_0.onerror) {
2026-07-23 10:11:24 +00:00
(function _installGlobalOnErrorHandler(arg0) {
const callback = arg0;
let result = callback(outer2_1[0]).addGlobalErrorInstrumentationHandler((msg) => {
2026-07-20 16:05:17 +00:00
let attachStacktrace;
let column;
let error;
let line;
let stackParser;
let url;
2026-07-23 10:11:24 +00:00
({ stackParser, attachStacktrace } = outer3_5());
let obj = callback(outer3_1[0]);
if (obj.getClient() === callback) {
2026-07-20 16:05:17 +00:00
if (!obj5.shouldIgnoreOnError()) {
({ url, line, column, error } = msg);
2026-07-23 10:11:24 +00:00
let obj2 = callback(outer3_1[2]);
2026-07-20 16:05:17 +00:00
msg = error;
if (!error) {
msg = msg.msg;
}
const result = obj2.eventFromUnknownInput(stackParser, msg, undefined, attachStacktrace, false);
2026-07-23 10:11:24 +00:00
(function _enhanceEventWithInitialFrame(result, url, line, column) {
2026-07-20 16:05:17 +00:00
const tmp = result.exception || {};
result.exception = tmp;
const tmp2 = tmp.values || [];
tmp.values = tmp2;
const tmp3 = tmp2[0] || {};
tmp2[0] = tmp3;
const tmp4 = tmp3.stacktrace || {};
tmp3.stacktrace = tmp4;
let arr = tmp4.frames || [];
tmp4.frames = arr;
2026-07-23 10:11:24 +00:00
let obj = callback(outer4_1[0]);
2026-07-20 16:05:17 +00:00
let combined;
if (obj.isString(url)) {
if (0 !== url.length) {
combined = url;
if (url.startsWith("data:")) {
const _HermesInternal = HermesInternal;
2026-07-23 10:11:24 +00:00
combined = "<" + callback(outer4_1[0]).stripDataUrlContent(url, false) + ">";
const obj2 = callback(outer4_1[0]);
2026-07-20 16:05:17 +00:00
}
}
}
if (null == combined) {
2026-07-23 10:11:24 +00:00
combined = callback(outer4_1[0]).getLocationHref();
const obj3 = callback(outer4_1[0]);
2026-07-20 16:05:17 +00:00
}
if (0 === arr.length) {
2026-07-23 10:11:24 +00:00
obj = { colno: column, filename: combined, function: callback(outer4_1[0]).UNKNOWN_FUNCTION, in_app: true, lineno: line };
2026-07-20 16:05:17 +00:00
arr = arr.push(obj);
}
return result;
2026-07-23 10:11:24 +00:00
})(result, url, line, column);
2026-07-20 16:05:17 +00:00
result.level = "error";
2026-07-23 10:11:24 +00:00
obj = { originalException: error, mechanism: { handled: false, type: "auto.browser.global_handlers.onerror" } };
callback(outer3_1[0]).captureEvent(result, obj);
let obj3 = callback(outer3_1[0]);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
obj5 = callback(outer3_1[1]);
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
})(arg0);
outer1_4("onerror");
2026-07-20 16:05:17 +00:00
}
if (closure_0.onunhandledrejection) {
2026-07-23 10:11:24 +00:00
(function _installGlobalOnUnhandledRejectionHandler(arg0) {
const callback = arg0;
let result = callback(outer2_1[0]).addGlobalUnhandledRejectionInstrumentationHandler((arg0) => {
2026-07-20 16:05:17 +00:00
let attachStacktrace;
let stackParser;
2026-07-23 10:11:24 +00:00
({ stackParser, attachStacktrace } = outer3_5());
2026-07-20 16:05:17 +00:00
let num = 0;
2026-07-23 10:11:24 +00:00
let obj = callback(outer3_1[0]);
if (obj.getClient() === callback) {
2026-07-20 16:05:17 +00:00
if (!obj6.shouldIgnoreOnError()) {
2026-07-23 10:11:24 +00:00
obj = outer3_2(arg0);
2026-07-20 16:05:17 +00:00
if (obj3.isPrimitive(obj)) {
2026-07-23 10:11:24 +00:00
let result = outer3_3(obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
const obj4 = callback(outer3_1[2]);
2026-07-20 16:05:17 +00:00
result = obj4.eventFromUnknownInput(stackParser, obj, undefined, attachStacktrace, true);
}
result.level = "error";
2026-07-23 10:11:24 +00:00
num = callback(outer3_1[num]);
2026-07-20 16:05:17 +00:00
obj = {};
obj.originalException = obj;
2026-07-23 10:11:24 +00:00
obj = { handled: false, type: "auto.browser.global_handlers.onunhandledrejection" };
2026-07-20 16:05:17 +00:00
obj.mechanism = obj;
num.captureEvent(result, obj);
2026-07-23 10:11:24 +00:00
obj3 = callback(outer3_1[num]);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
obj6 = callback(outer3_1[1]);
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
})(arg0);
outer1_4("onunhandledrejection");
2026-07-20 16:05:17 +00:00
}
}
};
return obj;
}
});