aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/errors/tracing.py
blob: 25b544ff694dc6b8eb8b066b0743edcbec4677ca (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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))
    }