Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Add logging to the error handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
esheehan-gsl committed Oct 30, 2023
1 parent 5d8fe4a commit afd55ba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/unified_graphics/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

@bp.errorhandler(GroupNotFoundError)
def handle_diag_group_not_found(e):
current_app.logger.exception("Unable to read diagnostic group")
if isinstance(e, FSPathExistNotDir):
return jsonify(msg="Unable to read diagnostic file group"), 500

Expand All @@ -29,6 +30,7 @@ def handle_diag_group_not_found(e):
# types of 404s, such as a missing variable, init time, or zarr
@bp.errorhandler(FileNotFoundError)
def handle_diag_file_not_found(e):
current_app.logger.exception("Diagnostic file not found")
return jsonify(msg="Diagnostic file not found"), 404


Expand All @@ -37,6 +39,7 @@ def handle_diag_file_not_found(e):
# types of 500s, such as an unknown variable
@bp.errorhandler(ValueError)
def handle_diag_file_read_error(e):
current_app.logger.exception("Unable to read diagnostic file")
# FIXME: Some ValueErrors should be 400s
return jsonify(msg="Unable to read diagnostic file"), 500

Expand Down

0 comments on commit afd55ba

Please sign in to comment.