Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
// Module ID: 16696
|
|
// Function ID: 16697
|
|
// Name: VibegrationsCreateErrors
|
|
// Dependencies: [1074, 1114, 3590, 2]
|
|
// Exports: classifyCreateFailure, createFailureStatus, getVibegrationsCreateErrorMessage
|
|
|
|
// Module 16696 (VibegrationsCreateErrors)
|
|
import Constants from "Constants" /* 1074 */;
|
|
import util from "util" /* 1114 */;
|
|
import _modDef3590 from "module_3590" /* 3590 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const AbortCodes = Constants.AbortCodes;
|
|
const prototype = function VibegrationsCreateError(reason, failureStatus) {
|
|
const tmp2 = new tmp("vibegrations create failed: " + reason + " [" + failureStatus + "]", " [", failureStatus, "]");
|
|
tmp2.name = "VibegrationsCreateError";
|
|
tmp2.reason = reason;
|
|
tmp2.status = failureStatus;
|
|
return tmp2;
|
|
}.prototype;
|
|
class prototype extends Error {
|
|
}
|
|
const result = size.fileFinishedImporting("modules/vibegrations/lib/VibegrationsCreateErrors.tsx");
|
|
|
|
export const VibegrationsCreateError = prototype;
|
|
export const classifyCreateFailure = function classifyCreateFailure(obj) {
|
|
if (typeof obj === "object") {
|
|
if (null !== obj) {
|
|
({ status, body } = obj);
|
|
if (typeof status !== "number") {
|
|
return "unknown";
|
|
} else if (429 === status) {
|
|
return "rate_limited";
|
|
} else {
|
|
if (body != null) {
|
|
const code = body.code;
|
|
}
|
|
let str2 = "unknown";
|
|
if (409 === status) {
|
|
str2 = "unknown";
|
|
if (code === AbortCodes.TOO_MANY_VIBEGRATIONS_PROJECTS) {
|
|
str2 = "project_limit";
|
|
}
|
|
}
|
|
return str2;
|
|
}
|
|
}
|
|
}
|
|
return "unknown";
|
|
};
|
|
export const createFailureStatus = function createFailureStatus(status) {
|
|
status = undefined;
|
|
if (status != null) {
|
|
status = status.status;
|
|
}
|
|
let num = 0;
|
|
if (typeof status === "number") {
|
|
num = status;
|
|
}
|
|
return num;
|
|
};
|
|
export const getVibegrationsCreateErrorMessage = function getVibegrationsCreateErrorMessage(reason) {
|
|
let str = "unknown";
|
|
if (reason instanceof prototype) {
|
|
str = reason.reason;
|
|
}
|
|
if ("project_limit" === str) {
|
|
const intl3 = util.intl;
|
|
return intl3.string(_modDef3590.Asusmn);
|
|
} else if ("rate_limited" === str) {
|
|
const intl2 = util.intl;
|
|
return intl2.string(_modDef3590.DT6qly);
|
|
} else {
|
|
const intl = util.intl;
|
|
return intl.string(_modDef3590.KKkp5Y);
|
|
}
|
|
};
|