Installer: .env-Hinweis + Beispiel-.env + Backend-Health-Check; freundlichere API-Fehler

- install.sh: ensure_example legt .env.example an falls fehlend; env_hint weist
  klar auf die anpassbare .env hin; wait_for_backend pollt /api/health und meldet
  502-Ursachen mit Log-Hinweis.
- web/api.js: HTML-Fehlerseiten (z.B. nginx 502) nicht mehr roh anzeigen,
  stattdessen verständliche Meldung.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-22 09:35:14 +02:00
parent 575dd1a354
commit f0f652ddbe
2 changed files with 82 additions and 9 deletions

View File

@@ -49,14 +49,22 @@ async function request(path, { method = "GET", body, form } = {}) {
}
if (!resp.ok) {
const detail =
(data && data.detail) ||
(typeof data === "string" ? data : null) ||
`Fehler ${resp.status}`;
throw new ApiError(
Array.isArray(detail) ? detail.map((d) => d.msg).join(", ") : detail,
resp.status
);
let detail;
if (data && data.detail) {
detail = Array.isArray(data.detail)
? data.detail.map((d) => d.msg).join(", ")
: data.detail;
} else if (resp.status === 502 || resp.status === 503 || resp.status === 504) {
detail = `Server nicht erreichbar (${resp.status}). Läuft der Backend-Dienst? Prüfe: docker compose logs backend`;
} else if (typeof data === "string" && data.trim().startsWith("<")) {
// HTML-Fehlerseite (z.B. von nginx) nicht roh anzeigen
detail = `Server-Fehler (${resp.status}).`;
} else if (typeof data === "string" && data) {
detail = data;
} else {
detail = `Fehler ${resp.status}`;
}
throw new ApiError(detail, resp.status);
}
return data;
}