From d7697efc3518aaa3dc74dd26713ebebacc29ce21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20N=C3=A4slund?= Date: Sun, 13 Nov 2022 22:43:22 +0100 Subject: typo and better error handling --- src/collector/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/collector/main.py') diff --git a/src/collector/main.py b/src/collector/main.py index beaf2ea..72c4ef7 100755 --- a/src/collector/main.py +++ b/src/collector/main.py @@ -164,4 +164,8 @@ async def info() -> JSONResponse: """ count = await db.estimated_document_count() - return JSONResponse(content={"status": "success", "estimated document count": count}) + + if count is None: + return JSONResponse(content={"status": "error", "message": "DB error"}, status_code=400) + + return JSONResponse(content={"status": "success", "Estimated document count": count}) -- cgit v1.1