improve debug of external issues

This commit is contained in:
Kenneth Kehl
2025-06-05 08:12:56 -07:00
parent 630641af1d
commit aa9cafb5f1

View File

@@ -1,4 +1,4 @@
from flask import Blueprint, jsonify, request from flask import Blueprint, current_app, jsonify, request
from sqlalchemy import text from sqlalchemy import text
from app import db, version from app import db, version
@@ -11,6 +11,7 @@ status = Blueprint("status", __name__)
@status.route("/", methods=["GET"]) @status.route("/", methods=["GET"])
@status.route("/_status", methods=["GET", "POST"]) @status.route("/_status", methods=["GET", "POST"])
def show_status(): def show_status():
try:
if request.args.get("simple", None): if request.args.get("simple", None):
return jsonify(status="ok"), 200 return jsonify(status="ok"), 200
else: else:
@@ -23,10 +24,15 @@ def show_status():
), ),
200, 200,
) )
except Exception as e:
current_app.logger.error(
f"Unexpected error in show_status: {str(e)}", exc_info=True
)
@status.route("/_status/live-service-and-organization-counts") @status.route("/_status/live-service-and-organization-counts")
def live_service_and_organization_counts(): def live_service_and_organization_counts():
try:
return ( return (
jsonify( jsonify(
organizations=dao_count_organizations_with_live_services(), organizations=dao_count_organizations_with_live_services(),
@@ -34,6 +40,11 @@ def live_service_and_organization_counts():
), ),
200, 200,
) )
except Exception as e:
current_app.logger.error(
f"Unexpected error in live_service_and_organization_counts: {str(e)}",
exc_info=True,
)
def get_db_version(): def get_db_version():