Repository navigation
feat(err): construct full trace if no traceback available - #266
Conversation
There was a problem hiding this comment.
PR Summary
Enhances exception handling in posthog/exception_utils.py by adding artificial traceback construction for exceptions that lack one, improving debugging capabilities with stack trace visualization.
- Added functionality to construct artificial tracebacks by walking through stack frames from current execution point
- Implemented reversed full-stack approach that shows more intuitive stack trace order for debugging
- Current implementation is explicitly noted as being naive to async considerations, which may need future enhancement
- Modified exception handling to attempt artificial traceback construction before falling back to system exception info
1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile
| if getattr(e, "__traceback__", None) is not None: | ||
| return | ||
|
|
||
| depth = 0 |
There was a problem hiding this comment.
Can we start the depth at 1 to remove the capture_exception frame?
There was a problem hiding this comment.
The one you see in the screenshot is actually the wrapper you added in posthog (there are 5 or 6 frames beneath this one, but they're correctly marked not-in-app, and I think it's fine to leave them)
There was a problem hiding this comment.
Would actually love to get rid of that wrapper soon. Think it's less necessary now that we have all the context stuff
This goes with the reversed-full-stack approach. It is naive to async considerations. Options below:
Original

Naive full stack:

Reversed full stack:
