From 2abcbc55602001d47831b41ec770b813e52906c2 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Thu, 5 Jun 2025 08:17:30 -0700 Subject: [PATCH] cleanup --- app/status/healthcheck.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/status/healthcheck.py b/app/status/healthcheck.py index 3c9093e8a..35e304f00 100644 --- a/app/status/healthcheck.py +++ b/app/status/healthcheck.py @@ -28,6 +28,7 @@ def show_status(): current_app.logger.error( f"Unexpected error in show_status: {str(e)}", exc_info=True ) + raise Exception(status_code=503, detail="Service temporarily unavailable") @status.route("/_status/live-service-and-organization-counts") @@ -45,9 +46,17 @@ def live_service_and_organization_counts(): f"Unexpected error in live_service_and_organization_counts: {str(e)}", exc_info=True, ) + raise Exception(status_code=503, detail="Service temporarily unavailable") def get_db_version(): - query = "SELECT version_num FROM alembic_version" - full_name = db.session.execute(text(query)).fetchone()[0] - return full_name + try: + query = "SELECT version_num FROM alembic_version" + full_name = db.session.execute(text(query)).fetchone()[0] + return full_name + except Exception as e: + current_app.logger.error( + f"Unexpected error in get_db_version: {str(e)}", + exc_info=True, + ) + raise Exception(status_code=503, detail="Database temporarily unavailable")