From a0917c6e1541b0f3059e99a9350c9aa970b49f8b Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 16 Jan 2025 06:08:47 +0100 Subject: [PATCH 1/3] Do set the exception group marker when there is a suppressed exception --- sentry/src/main/java/io/sentry/SentryExceptionFactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sentry/src/main/java/io/sentry/SentryExceptionFactory.java b/sentry/src/main/java/io/sentry/SentryExceptionFactory.java index 2808df11c0b..a6138aa3988 100644 --- a/sentry/src/main/java/io/sentry/SentryExceptionFactory.java +++ b/sentry/src/main/java/io/sentry/SentryExceptionFactory.java @@ -189,7 +189,9 @@ Deque extractExceptionQueueInternal( Throwable[] suppressed = currentThrowable.getSuppressed(); if (suppressed != null && suppressed.length > 0) { - exceptionMechanism.setExceptionGroup(true); + // Disabled for now as it causes grouping in Sentry to sometimes use + // the suppressed exception as main exception. + // exceptionMechanism.setExceptionGroup(true); for (Throwable suppressedThrowable : suppressed) { extractExceptionQueueInternal( suppressedThrowable, exceptionId, circularityDetector, exceptions); From d53ecc071a07b431ff8cd681bf2cfeba2f9e1771 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 17 Jan 2025 13:44:58 +0100 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6807041b529..bc8410f7a46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased +### Fixes + +- Do not set the exception group marker when there is a suppressed exception ([#4056](https://github.com/getsentry/sentry-java/pull/4056)) + - Due to how grouping works in Sentry currently sometimes the suppressed exception is treated as the main exception. This change ensures we keep using the main exception and not change how grouping works. + - As a consequence the list of exceptions in the group on top of an issue is no longer shown in Sentry UI. + - We are planning to improve this in the future but opted for this fix first. + ### Internal - Make `SentryClient` constructor public ([#4045](https://github.com/getsentry/sentry-java/pull/4045)) From dc0abe029dfcf9dabec45908240cb0f4602a9f47 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 17 Jan 2025 13:45:47 +0100 Subject: [PATCH 3/3] comment out test assertions for is group flag --- .../io/sentry/SentryExceptionFactoryTest.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt b/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt index 8eb7f0e42d1..69a77213592 100644 --- a/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt @@ -231,7 +231,7 @@ class SentryExceptionFactoryTest { assertEquals("message", mainInQueue.value) assertEquals(0, mainInQueue.mechanism?.exceptionId) - assertEquals(true, mainInQueue.mechanism?.isExceptionGroup) +// assertEquals(true, mainInQueue.mechanism?.isExceptionGroup) } @Test @@ -255,12 +255,12 @@ class SentryExceptionFactoryTest { assertEquals("inner", mainInQueue.value) assertEquals(1, mainInQueue.mechanism?.exceptionId) assertEquals(0, mainInQueue.mechanism?.parentId) - assertEquals(true, mainInQueue.mechanism?.isExceptionGroup) +// assertEquals(true, mainInQueue.mechanism?.isExceptionGroup) assertEquals("outer", outerInQueue.value) assertEquals(0, outerInQueue.mechanism?.exceptionId) assertNull(outerInQueue.mechanism?.parentId) - assertNull(outerInQueue.mechanism?.isExceptionGroup) +// assertNull(outerInQueue.mechanism?.isExceptionGroup) } @Test @@ -288,12 +288,12 @@ class SentryExceptionFactoryTest { assertEquals("inner", mainInQueue.value) assertEquals(1, mainInQueue.mechanism?.exceptionId) assertEquals(0, mainInQueue.mechanism?.parentId) - assertEquals(true, mainInQueue.mechanism?.isExceptionGroup) +// assertEquals(true, mainInQueue.mechanism?.isExceptionGroup) assertEquals("outer", outerInQueue.value) assertEquals(0, outerInQueue.mechanism?.exceptionId) assertNull(outerInQueue.mechanism?.parentId) - assertNull(outerInQueue.mechanism?.isExceptionGroup) +// assertNull(outerInQueue.mechanism?.isExceptionGroup) } @Test @@ -324,7 +324,7 @@ class SentryExceptionFactoryTest { assertEquals("innermost", innerMostExceptionInQueue.value) assertEquals(3, innerMostExceptionInQueue.mechanism?.exceptionId) assertEquals(1, innerMostExceptionInQueue.mechanism?.parentId) - assertEquals(true, innerMostExceptionInQueue.mechanism?.isExceptionGroup) +// assertEquals(true, innerMostExceptionInQueue.mechanism?.isExceptionGroup) assertEquals("suppressed", innerSuppressedInQueue.value) assertEquals(2, innerSuppressedInQueue.mechanism?.exceptionId) @@ -334,7 +334,7 @@ class SentryExceptionFactoryTest { assertEquals("inner", innerExceptionInQueue.value) assertEquals(1, innerExceptionInQueue.mechanism?.exceptionId) assertEquals(0, innerExceptionInQueue.mechanism?.parentId) - assertEquals(true, innerExceptionInQueue.mechanism?.isExceptionGroup) +// assertEquals(true, innerExceptionInQueue.mechanism?.isExceptionGroup) assertEquals("outer", outerInQueue.value) assertEquals(0, outerInQueue.mechanism?.exceptionId) @@ -378,7 +378,7 @@ class SentryExceptionFactoryTest { assertEquals("innermost", innerMostExceptionInQueue.value) assertEquals(3, innerMostExceptionInQueue.mechanism?.exceptionId) assertEquals(1, innerMostExceptionInQueue.mechanism?.parentId) - assertEquals(true, innerMostExceptionInQueue.mechanism?.isExceptionGroup) +// assertEquals(true, innerMostExceptionInQueue.mechanism?.isExceptionGroup) assertEquals("suppressed", innerSuppressedInQueue.value) assertEquals(2, innerSuppressedInQueue.mechanism?.exceptionId) @@ -388,7 +388,7 @@ class SentryExceptionFactoryTest { assertEquals("inner", innerExceptionInQueue.value) assertEquals(1, innerExceptionInQueue.mechanism?.exceptionId) assertEquals(0, innerExceptionInQueue.mechanism?.parentId) - assertEquals(true, innerExceptionInQueue.mechanism?.isExceptionGroup) +// assertEquals(true, innerExceptionInQueue.mechanism?.isExceptionGroup) assertEquals("outer", outerInQueue.value) assertEquals(0, outerInQueue.mechanism?.exceptionId)