v7.2.1 — Database Error Handling
Bug Fixes
- Login: When the database is unreachable, the login endpoint now falls through to master env var credentials instead of returning a generic "Unexpected error". Viewer-only users see a clear "Database temporarily unavailable" message (HTTP 503).
- All data endpoints: Connection errors now return HTTP 503 "Database temporarily unavailable" instead of generic HTTP 500 "Internal server error".
- Audit log resilience: Audit log writes in the login flow are wrapped in try/except so they never crash the response.
New Features
- Global exception handler: Catches unhandled DB connection errors across all endpoints (including admin) and returns 503.
- Health endpoint:
GET /api/healthreturns{"status": "ok", "database": "connected"}(200) or{"status": "degraded", "database": "unreachable"}(503). Useful for Docker healthchecks and monitoring.
Internal
- Added
_is_db_connection_error()helper that walks the exception chain looking forOSError(coverssocket.gaierror,ConnectionRefusedError, etc.)
Closes #92