fix(snot): surface DB connection errors and clear stale error banner on search
This commit is contained in:
1 parent
d5a4764c4b
commit
3b81216892
2 files changed
+9
-5
No files matched your search
+8
-5
@@ -551,11 +551,14 @@ def fetch_videos(params: dict[str, str]) -> list[dict[str, Any]]:
|
||||
rows: list[dict[str, Any]] = []
|
||||
total: int | None = None
|
||||
while total is None or len(rows) < total:
|
||||
response = client.get(
|
||||
"/videos",
|
||||
params={**params, "limit": "1000", "offset": str(len(rows))},
|
||||
headers={"Prefer": "count=exact"} if total is None else None,
|
||||
)
|
||||
try:
|
||||
response = client.get(
|
||||
"/videos",
|
||||
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()
|
||||
page = response.json()
|
||||
if total is None:
|
||||
|
||||
Reference in new issue
Block a user