Skip to content

Commit 2445593

Browse files
committed
Updated some tests
1 parent e07601c commit 2445593

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

sentry_sdk/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ def single_exception_from_error_tuple(
672672
is_root_exception = exception_id == 0
673673
if not is_root_exception and parent_id is not None:
674674
exception_value["mechanism"]["parent_id"] = parent_id
675-
if "type" not in exception_value["mechanism"]:
675+
if exception_id is not None and exception_id > 0:
676676
exception_value["mechanism"]["type"] = "chained"
677677

678678
if is_root_exception and "type" not in exception_value["mechanism"]:

tests/test_exceptiongroup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ def test_exception_chain_cause():
217217
{
218218
"mechanism": {
219219
"handled": False,
220-
"type": "test_suite",
220+
"type": "chained",
221+
"exception_id": 1,
222+
"parent_id": 0,
223+
"source": "__cause__",
221224
},
222225
"module": None,
223226
"type": "TypeError",
@@ -227,6 +230,7 @@ def test_exception_chain_cause():
227230
"mechanism": {
228231
"handled": False,
229232
"type": "test_suite",
233+
"exception_id": 0,
230234
},
231235
"module": None,
232236
"type": "ValueError",
@@ -257,8 +261,10 @@ def test_exception_chain_context():
257261
{
258262
"mechanism": {
259263
"handled": False,
260-
"type": "test_suite",
264+
"type": "chained",
261265
"exception_id": 1,
266+
"parent_id": 0,
267+
"source": "__context__",
262268
},
263269
"module": None,
264270
"type": "TypeError",

0 commit comments

Comments
 (0)