decord/source/modules/threads/FormError.tsx

76 lines
2.4 KiB
TypeScript
Raw Normal View History

// Module ID: 16726
// Function ID: 16727
// Name: threads/FormError
// Dependencies: [1114, 8043, 2]
2026-07-20 16:05:17 +00:00
// Exports: makeApiNameRequiredError, makeAutomodViolationError, makeEmptyMessageError, makeEmptyTitleError, renderError
// Module 16726 (threads/FormError)
import util from "util" /* 1114 */;
import AutomodErrorUtils from "AutomodErrorUtils" /* 8043 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
const FormSubmitErrorType = { EmptyContent: 0, [0]: "EmptyContent", AutomodViolation: 1, [1]: "AutomodViolation", ApiValidation: 2, [2]: "ApiValidation" };
const result = size.fileFinishedImporting("modules/threads/FormError.tsx");
2026-07-20 16:05:17 +00:00
export { FormSubmitErrorType };
2026-07-20 16:05:17 +00:00
export const makeEmptyTitleError = function makeEmptyTitleError() {
const intl = util.intl;
let stringResult = intl.string(util.t.uXA573);
2026-07-29 08:29:29 +00:00
obj = { type: obj.EmptyContent, message: null };
if (stringResult == null) {
stringResult = null;
}
obj.message = stringResult;
2026-07-29 08:29:29 +00:00
return obj;
2026-07-20 16:05:17 +00:00
};
export const makeEmptyMessageError = function makeEmptyMessageError() {
const intl = util.intl;
let stringResult = intl.string(util.t.kesTVT);
2026-07-29 08:29:29 +00:00
obj = { type: obj.EmptyContent, message: null };
if (stringResult == null) {
stringResult = null;
}
obj.message = stringResult;
2026-07-29 08:29:29 +00:00
return obj;
2026-07-20 16:05:17 +00:00
};
export const makeApiNameRequiredError = function makeApiNameRequiredError() {
const intl = util.intl;
let stringResult = intl.string(util.t.uXA573);
2026-07-29 08:29:29 +00:00
obj = { type: obj.ApiValidation, message: null };
if (stringResult == null) {
stringResult = null;
}
obj.message = stringResult;
2026-07-29 08:29:29 +00:00
return obj;
2026-07-20 16:05:17 +00:00
};
export const makeAutomodViolationError = function makeAutomodViolationError(errorResponseBody, id) {
const obj = AutomodErrorUtils;
2026-07-20 16:05:17 +00:00
id = undefined;
2026-07-29 08:29:29 +00:00
if (id != null) {
2026-07-20 16:05:17 +00:00
id = id.id;
}
2026-07-29 08:29:29 +00:00
let automodErrorMessageFromErrorResponse = obj.getAutomodErrorMessageFromErrorResponse(errorResponseBody, id);
const obj2 = { type: obj.AutomodViolation, message: null };
2026-07-29 08:29:29 +00:00
if (automodErrorMessageFromErrorResponse == null) {
automodErrorMessageFromErrorResponse = null;
}
obj2.message = automodErrorMessageFromErrorResponse;
return obj2;
2026-07-20 16:05:17 +00:00
};
export const renderError = function renderError(type, content) {
let tmp = null;
if (null != type) {
if (type.type === obj.EmptyContent) {
if (null != content.content) {
tmp = null;
}
}
2026-07-29 08:29:29 +00:00
let message = type.message;
if (message == null) {
message = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = message;
2026-07-20 16:05:17 +00:00
}
return tmp;
};