aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-24 11:57:33 -0500
committerFrederick Muriuki Muriithi2024-07-31 09:30:25 -0500
commit104cf1f238815685582b48e62b0bcd538090ae5f (patch)
tree812b1673e81fd01be8b608aa7372ec1bc389514c
parent62c5e94349672052ba70fa72ab489d86fdc5da10 (diff)
downloadgn-auth-104cf1f238815685582b48e62b0bcd538090ae5f.tar.gz
Add some debug logging for errors.
-rw-r--r--gn_auth/errors.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/gn_auth/errors.py b/gn_auth/errors.py
index 1b6bc81..ea1a60e 100644
--- a/gn_auth/errors.py
+++ b/gn_auth/errors.py
@@ -18,6 +18,7 @@ def add_trace(exc: Exception, errobj: dict) -> dict:
def page_not_found(exc):
"""404 handler."""
+ current_app.logger.debug(f"Page '{request.url}' was not found.", exc_info=True)
content_type = request.content_type
if bool(content_type) and content_type.lower() == "application/json":
return jsonify(add_trace(exc, {
@@ -31,6 +32,7 @@ def page_not_found(exc):
def handle_general_exception(exc: Exception):
"""Handle generic unhandled exceptions."""
+ current_app.logger.debug("Error occurred!", exc_info=True)
content_type = request.content_type
if bool(content_type) and content_type.lower() == "application/json":
msg = ("The following exception was raised while attempting to access "
@@ -48,6 +50,7 @@ def handle_general_exception(exc: Exception):
def handle_authorisation_error(exc: AuthorisationError):
"""Handle AuthorisationError if not handled anywhere else."""
+ current_app.logger.debug("Error occurred!", exc_info=True)
current_app.logger.error(exc)
return jsonify(add_trace(exc, {
"error": type(exc).__name__,