Skip to content

Commit 1af0708

Browse files
committed
Better handling of exception groups
1 parent 889aec4 commit 1af0708

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

sentry_sdk/utils.py

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -872,36 +872,17 @@ def exceptions_from_error_tuple(
872872
# type: (...) -> List[Dict[str, Any]]
873873
exc_type, exc_value, tb = exc_info
874874

875-
is_exception_group = BaseExceptionGroup is not None and isinstance(
876-
exc_value, BaseExceptionGroup
875+
_, exceptions = exceptions_from_error(
876+
exc_type=exc_type,
877+
exc_value=exc_value,
878+
tb=tb,
879+
client_options=client_options,
880+
mechanism=mechanism,
881+
exception_id=0,
882+
parent_id=0,
883+
full_stack=full_stack,
877884
)
878885

879-
if is_exception_group:
880-
(_, exceptions) = exceptions_from_error(
881-
exc_type=exc_type,
882-
exc_value=exc_value,
883-
tb=tb,
884-
client_options=client_options,
885-
mechanism=mechanism,
886-
exception_id=0,
887-
parent_id=0,
888-
full_stack=full_stack,
889-
)
890-
891-
else:
892-
exceptions = []
893-
for exc_type, exc_value, tb in walk_exception_chain(exc_info):
894-
exceptions.append(
895-
single_exception_from_error_tuple(
896-
exc_type=exc_type,
897-
exc_value=exc_value,
898-
tb=tb,
899-
client_options=client_options,
900-
mechanism=mechanism,
901-
full_stack=full_stack,
902-
)
903-
)
904-
905886
exceptions.reverse()
906887

907888
return exceptions

0 commit comments

Comments
 (0)