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

Add logging to the error handlers #428

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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