8000 fix: Send chained exceptions in the correct order · etherscan-io/sentry-python@5df96a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5df96a2

Browse files
committed
fix: Send chained exceptions in the correct order
1 parent aba45f4 commit 5df96a2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

sentry_sdk/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ def exceptions_from_error_tuple(
569569
exc_type, exc_value, tb, 10043 client_options, mechanism
570570
)
571571
)
572+
573+
rv.reverse()
574+
572575
return rv
573576

574577

tests/test_client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,21 @@ def test_chained_exceptions(sentry_init, capture_events):
419419

420420
try:
421421
try:
422-
1 / 0
422+
raise ValueError()
423423
except Exception:
424424
1 / 0
425425
except Exception:
426426
capture_exception()
427427

428428
event, = events
429429

430-
assert len(event["exception"]["values"]) == 2
430+
e1, e2 = event["exception"]["values"]
431+
432+
# This is the order all other SDKs send chained exceptions in. Including
433+
# Raven-Python.
434+
435+
assert e1["type"] == "ValueError"
436+
assert e2["type"] == "ZeroDivisionError"
431437

432438

433439
@pytest.mark.tests_internal_exceptions

0 commit comments

Comments
 (0)
0