Skip to content

Commit cc8e329

Browse files
committed
Better handling of exception groups
1 parent 8672dc1 commit cc8e329

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
@@ -897,36 +897,17 @@ def exceptions_from_error_tuple(
897897
# type: (...) -> List[Dict[str, Any]]
898898
exc_type, exc_value, tb = exc_info
899899

900-
is_exception_group = BaseExceptionGroup is not None and isinstance(
901-
exc_value, BaseExceptionGroup
900+
_, exceptions = exceptions_from_error(
901+
exc_type=exc_type,
902+
exc_value=exc_value,
903+
tb=tb,
904+
client_options=client_options,
905+
mechanism=mechanism,
906+
exception_id=0,
907+
parent_id=0,
908+
full_stack=full_stack,
902909
)
903910

904-
if is_exception_group:
905-
(_, exceptions) = exceptions_from_error(
906-
exc_type=exc_type,
907-
exc_value=exc_value,
908-
tb=tb,
909-
client_options=client_options,
910-
mechanism=mechanism,
911-
exception_id=0,
912-
parent_id=0,
913-
full_stack=full_stack,
914-
)
915-
916-
else:
917-
exceptions = []
918-
for exc_type, exc_value, tb in walk_exception_chain(exc_info):
919-
exceptions.append(
920-
single_exception_from_error_tuple(
921-
exc_type=exc_type,
922-
exc_value=exc_value,
923-
tb=tb,
924-
client_options=client_options,
925-
mechanism=mechanism,
926-
full_stack=full_stack,
927-
)
928-
)
929-
930911
exceptions.reverse()
931912

932913
return exceptions

0 commit comments

Comments
 (0)