Skip to content

Commit

Permalink
Adding exception logging (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
manasaV3 committed Aug 2, 2023
1 parent b475b43 commit 81a7235
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions backend/api/app.py
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion backend/api/metrics.py
Expand Up @@ -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.
Expand Down

0 comments on commit 81a7235

Please sign in to comment.