diff options
| author | Victor Näslund <victor@sunet.se> | 2022-11-13 22:43:22 +0100 |
|---|---|---|
| committer | Victor Näslund <victor@sunet.se> | 2022-11-13 22:43:22 +0100 |
| commit | d7697efc3518aaa3dc74dd26713ebebacc29ce21 (patch) | |
| tree | d3e2560204561ef7d1d2330e92e91856982670d8 /src | |
| parent | 0ff87151ab15e558d46e2fe9de86213c683f60f9 (diff) | |
typo and better error handling
Diffstat (limited to 'src')
| -rwxr-xr-x | src/collector/main.py | 6 |
1 files changed, 5 insertions, 1 deletions
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}) |
