decord/source/modules/errors/ErrorHandlingUtils.tsx

77 lines
2.2 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 5848
// Function ID: 5849
2026-07-20 16:05:17 +00:00
// Name: items
2026-07-29 08:29:29 +00:00
// Dependencies: [676, 1208, 2]
2026-07-20 16:05:17 +00:00
// Exports: captureOrIgnoreApiError
2026-08-05 07:35:12 +00:00
// Module 5848 (items)
2026-07-23 10:11:24 +00:00
import set from "set";
2026-07-20 16:05:17 +00:00
const items = [, , ];
2026-07-23 10:11:24 +00:00
({ UNAUTHORIZED: arr[0], EMAIL_VERIFICATION_REQUIRED: arr[1], USER_BANNED: arr[2] } = require("ME").AbortCodes);
let set = new Set([500, 502, 503, 504]);
const set1 = new Set([401, 403, 405, 409, 429]);
const result = set.fileFinishedImporting("modules/errors/ErrorHandlingUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const captureOrIgnoreApiError = function captureOrIgnoreApiError(aPIError) {
let tmp = null == aPIError;
2026-07-20 16:05:17 +00:00
if (!tmp) {
let flag = false;
2026-07-29 08:29:29 +00:00
if (null != aPIError) {
let cause;
if (aPIError != null) {
cause = aPIError.cause;
2026-07-20 16:05:17 +00:00
}
let crossDomain;
2026-07-29 08:29:29 +00:00
if (cause != null) {
2026-07-20 16:05:17 +00:00
crossDomain = cause.crossDomain;
}
let tmp4 = true === crossDomain;
if (!tmp4) {
2026-08-04 21:03:28 +00:00
let tmp5 = !("status" in aPIError) || typeof aPIError.status !== "number";
2026-07-29 08:29:29 +00:00
if (!tmp5) {
let tmp6 = 0 !== aPIError.status;
if (tmp6) {
tmp6 = !set.has(aPIError.status);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp6) {
tmp6 = !set1.has(aPIError.status);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp5 = tmp6;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp9 = !tmp5;
if (tmp5) {
2026-08-04 21:03:28 +00:00
let tmp10 = !("code" in aPIError) || typeof aPIError.code !== "number";
2026-07-29 08:29:29 +00:00
if (!tmp10) {
tmp10 = !items.includes(aPIError.code);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp12 = !tmp10;
if (tmp10) {
2026-08-04 21:03:28 +00:00
let hasItem = "body" in aPIError && null != aPIError.body && typeof aPIError.body === "object" && "code" in aPIError.body;
2026-07-20 16:05:17 +00:00
if (hasItem) {
2026-07-29 08:29:29 +00:00
const body = aPIError.body;
2026-07-20 16:05:17 +00:00
let code;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
code = body.code;
}
2026-08-04 21:03:28 +00:00
hasItem = typeof code === "number";
2026-07-20 16:05:17 +00:00
}
if (hasItem) {
2026-07-29 08:29:29 +00:00
hasItem = items.includes(aPIError.body.code);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp12 = hasItem;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp9 = tmp12;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = tmp9;
2026-07-20 16:05:17 +00:00
}
flag = tmp4;
}
tmp = flag;
}
if (!tmp) {
2026-07-29 08:29:29 +00:00
importDefault(1208).captureException(aPIError);
const obj = importDefault(1208);
2026-07-20 16:05:17 +00:00
}
};