25 lines
792 B
TypeScript
25 lines
792 B
TypeScript
const NON_PROVIDER_REQUEST_STATUSES = new Set([400, 413, 415, 422]);
|
|
|
|
export function isMediaInputFailure(message: string) {
|
|
const normalized = String(message || "").trim().toLowerCase();
|
|
return (
|
|
normalized.includes("media request is invalid") ||
|
|
normalized.includes("invalid media request") ||
|
|
normalized.includes("invalid input media") ||
|
|
normalized.includes("unsupported media type") ||
|
|
normalized.includes("vip98k reference staging failed")
|
|
);
|
|
}
|
|
|
|
export function isNonProviderRequestStatus(
|
|
httpStatus: number | null,
|
|
message: string,
|
|
) {
|
|
if (httpStatus !== null && NON_PROVIDER_REQUEST_STATUSES.has(httpStatus)) {
|
|
return true;
|
|
}
|
|
|
|
const normalized = String(message || "").trim();
|
|
return /(?:^|\D)(?:400|413|415|422)(?:\D|$)/.test(normalized);
|
|
}
|