fix(snot): surface DB connection errors and clear stale error banner on search

This commit is contained in:
abdus committed 2026-10-17 15:35:45 +03:00
1 parent d5a4764c4b
commit 3b81216892
2 files changed
+9 -5

No files matched your search

+1
View File
@@ -351,6 +351,7 @@
}, },
async search() { async search() {
this.errorMessage = "";
const response = await fetch("/search", { const response = await fetch("/search", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
+8 -5
View File
@@ -551,11 +551,14 @@ def fetch_videos(params: dict[str, str]) -> list[dict[str, Any]]:
rows: list[dict[str, Any]] = [] rows: list[dict[str, Any]] = []
total: int | None = None total: int | None = None
while total is None or len(rows) < total: while total is None or len(rows) < total:
response = client.get( try:
"/videos", response = client.get(
params={**params, "limit": "1000", "offset": str(len(rows))}, "/videos",
headers={"Prefer": "count=exact"} if total is None else None, params={**params, "limit": "1000", "offset": str(len(rows))},
) headers={"Prefer": "count=exact"} if total is None else None,
)
except httpx.ConnectError as e:
raise RuntimeError(f"Cannot reach database at {client.base_url} ({e}). Is the server running and reachable?") from e
response.raise_for_status() response.raise_for_status()
page = response.json() page = response.json()
if total is None: if total is None: