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
+4
No files matched your search
@@ -351,6 +351,7 @@
|
||||
},
|
||||
|
||||
async search() {
|
||||
this.errorMessage = "";
|
||||
const response = await fetch("/search", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
||||
@@ -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:
|
||||
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