8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a28a3b commit b92b2b0Copy full SHA for b92b2b0
sentry_sdk/utils.py
@@ -458,18 +458,6 @@ def serialize_frame(frame, tb_lineno=None, with_locals=True):
458
return rv
459
460
461
-def stacktrace_from_traceback(tb=None, with_locals=True):
462
- # type: (Optional[TracebackType], bool) -> Dict[str, List[Dict[str, Any]]]
463
- return {
464
- "frames": [
465
- serialize_frame(
466
- tb.tb_frame, tb_lineno=tb.tb_lineno, with_locals=with_locals
467
- )
468
- for tb in iter_stacks(tb)
469
- ]
470
- }
471
-
472
473
def current_stacktrace(with_locals=True):
474
# type: (bool) -> Any
475
__tracebackhide__ = True
@@ -515,14 +503,23 @@ def single_exception_from_error_tuple(
515
503
else:
516
504
with_locals = client_options["with_locals"]
517
505
518
506
+ frames = [
507
+ serialize_frame(tb.tb_frame, tb_lineno=tb.tb_lineno, with_locals=with_locals)
508
+ for tb in iter_stacks(tb)
509
+ ]
510
+
511
+ rv = {
519
512
"module": get_type_module(exc_type),
520
513
"type": get_type_name(exc_type),
521
514
"value": safe_str(exc_value),
522
"mechanism": mechanism,
523
- "stacktrace": stacktrace_from_traceback(tb, with_locals),
524
}
525
+ if frames:
+ rv["stacktrace"] = {"frames": frames}
+ return rv
526
527
HAS_CHAINED_EXCEPTIONS = hasattr(Exception, "__suppress_context__")
528
0 commit comments