diff options
author | Frederick Muriuki Muriithi | 2025-07-09 09:36:21 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-07-09 09:36:21 -0500 |
commit | 72fcbb0fc1e0c347c827042722c68ab5efbcfb2e (patch) | |
tree | be8752f36cda38c628d87f38e693e0d6e7824660 /gn_auth/errors/tracing.py | |
parent | f703399bdda4d4f4362653bdea4190804c3590d5 (diff) | |
download | gn-auth-72fcbb0fc1e0c347c827042722c68ab5efbcfb2e.tar.gz |
Move error handling into separate package.
Diffstat (limited to 'gn_auth/errors/tracing.py')
-rw-r--r-- | gn_auth/errors/tracing.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gn_auth/errors/tracing.py b/gn_auth/errors/tracing.py new file mode 100644 index 0000000..25b544f --- /dev/null +++ b/gn_auth/errors/tracing.py @@ -0,0 +1,18 @@ +"""Utilities for improving error tracing.""" +import logging +import traceback + +from flask import request + +logger = logging.getLogger(__name__) + + +def add_trace(exc: Exception, errobj: dict) -> dict: + """Add the traceback to the error handling object.""" + logger.error("Endpoint: %s\n%s", + request.url, + traceback.format_exception(exc)) + return { + **errobj, + "error-trace": "".join(traceback.format_exception(exc)) + } |