decord/source/modules/errors/ErrorHandlingUtils.tsx
github-actions 4f02868c60 chore: update source for alpha 346.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
2026-09-11 10:30:06 +00:00

77 lines
2.3 KiB
TypeScript

// Module ID: 7413
// Function ID: 7414
// Name: ErrorHandlingUtils
// Dependencies: [1074, 1232, 2]
// Exports: captureOrIgnoreApiError
// Module 7413 (ErrorHandlingUtils)
import Constants from "Constants" /* 1074 */;
import SentryUtilsDefault from "SentryUtils" /* 1232 */;
import size from "module_2" /* 2 */;
const items = [, , ];
({ UNAUTHORIZED: arr[0], EMAIL_VERIFICATION_REQUIRED: arr[1], USER_BANNED: arr[2] } = Constants.AbortCodes);
const set = new Set([500, 502, 503, 504]);
const set1 = new Set([401, 403, 405, 409, 429]);
const result = size.fileFinishedImporting("modules/errors/ErrorHandlingUtils.tsx");
export const captureOrIgnoreApiError = function captureOrIgnoreApiError(aPIError) {
let tmp = null == aPIError;
if (!tmp) {
let flag = false;
if (null != aPIError) {
let cause;
if (aPIError != null) {
cause = aPIError.cause;
}
let crossDomain;
if (cause != null) {
crossDomain = cause.crossDomain;
}
let tmp4 = true === crossDomain;
if (!tmp4) {
let tmp5 = !("status" in aPIError) || typeof aPIError.status !== "number";
if (!tmp5) {
let tmp6 = 0 !== aPIError.status;
if (tmp6) {
tmp6 = !set.has(aPIError.status);
}
if (tmp6) {
tmp6 = !set1.has(aPIError.status);
}
tmp5 = tmp6;
}
let tmp9 = !tmp5;
if (tmp5) {
let tmp10 = !("code" in aPIError) || typeof aPIError.code !== "number";
if (!tmp10) {
tmp10 = !items.includes(aPIError.code);
}
let tmp12 = !tmp10;
if (tmp10) {
let hasItem = "body" in aPIError && null != aPIError.body && typeof aPIError.body === "object" && "code" in aPIError.body;
if (hasItem) {
const body = aPIError.body;
let code;
if (body != null) {
code = body.code;
}
hasItem = typeof code === "number";
}
if (hasItem) {
hasItem = items.includes(aPIError.body.code);
}
tmp12 = hasItem;
}
tmp9 = tmp12;
}
tmp4 = tmp9;
}
flag = tmp4;
}
tmp = flag;
}
if (!tmp) {
SentryUtilsDefault.captureException(aPIError);
}
};