diff --git a/backend/api/app.py b/backend/api/app.py index 2596019e2..104ae62e3 100644 --- a/backend/api/app.py +++ b/backend/api/app.py @@ -191,11 +191,13 @@ def handle_exception(e) -> Response: @app.errorhandler(exceptions.Unauthorized) def handle_permission_exception(e) -> Response: + logger.error(f"Unauthorized Access to endpoint {request.method} {request.endpoint}") return app.make_response(("Unauthorized Access", 401)) @app.errorhandler(Exception) def handle_exception(e) -> Response: + logger.error(f"An unexpected error has occurred in napari hub: {e}", e) send_alert(f"An unexpected error has occurred in napari hub: {e}") return app.make_response(("Internal Server Error", 500)) diff --git a/backend/api/metrics.py b/backend/api/metrics.py index 4bb34b1ef..cd0846d5a 100644 --- a/backend/api/metrics.py +++ b/backend/api/metrics.py @@ -52,7 +52,7 @@ def _get_usage_data(name: str, limit: int) -> Dict[str, Any]: } -def _get_maintenance_data(name: str, repo: Any, limit: int) -> Dict[str, Any]: +def _get_maintenance_data(name: str, repo: Optional[str], limit: int) -> Dict[str, Any]: """ Fetches plugin maintenance_data from dynamo. :returns Dict[str, Any]: A dict with entries for timeline and stats.