Skip to content

Commit 8c957c6

Browse files
committed
Updated some tests
1 parent e5d4f56 commit 8c957c6

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
@@ -697,7 +697,7 @@ def single_exception_from_error_tuple(
697697
is_root_exception = exception_id == 0
698698
if not is_root_exception and parent_id is not None:
699699
exception_value["mechanism"]["parent_id"] = parent_id
700-
if "type" not in exception_value["mechanism"]:
700+
if exception_id is not None and exception_id > 0:
701701
exception_value["mechanism"]["type"] = "chained"
702702

703703
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)