Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:35:57 +02:00
commit 1dfbca08a1
528 files changed
+131054

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
const invalidApiResponse = /unexpected token|doctype|not valid json|json parse|syntaxerror/i;
const htmlResponse = /<html|<!doctype|<body/i;
export const formatOperatorError = (error: unknown, fallback: string): string => {
const raw = error instanceof Error ? error.message : String(error || "");
const normalized = raw.trim();
if (!normalized) return fallback;
if (invalidApiResponse.test(normalized) || htmlResponse.test(normalized)) {
return `${fallback} De backendbron gaf geen geldige API-respons.`;
}
if (normalized.length > 240) {
return `${normalized.slice(0, 237)}...`;
}
return normalized;
};