Skip to content

Commit 6866060

Browse files
adinauerclaude
andcommitted
fix(core): Stop deduplication at ignored causes
Treat ignored exceptions as cause-chain boundaries so deeper causes do not discard an event while non-ignored wrappers remain deduplicatable. Refs #6365 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b98e834 commit 6866060

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎sentry/src/main/java/io/sentry/DuplicateEventDetectionEventProcessor.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ public DuplicateEventDetectionEventProcessor(final @NotNull SentryOptions option
4848

4949
private boolean containsAnyKey(final @NotNull List<Throwable> throwables) {
5050
for (final Throwable throwable : throwables) {
51-
if (!isIgnoredForDeduplication(throwable) && capturedObjects.containsKey(throwable)) {
51+
if (isIgnoredForDeduplication(throwable)) {
52+
return false;
53+
}
54+
if (capturedObjects.containsKey(throwable)) {
5255
return true;
5356
}
5457
}

‎sentry/src/test/java/io/sentry/DuplicateEventDetectionEventProcessorTest.kt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ class DuplicateEventDetectionEventProcessorTest {
113113
assertThat(processor.process(SentryEvent(RuntimeException(cause)), Hint())).isNotNull()
114114
}
115115

116+
@Test
117+
fun `stops checking causes after ignored cause`() {
118+
val options =
119+
SentryOptions().apply {
120+
setIgnoredErrorsForDeduplication(listOf(IgnoredForDeduplicationException::class.java.name))
121+
}
122+
val processor = DuplicateEventDetectionEventProcessor(options)
123+
val deeperCause = RuntimeException()
124+
assertThat(processor.process(SentryEvent(deeperCause), Hint())).isNotNull()
125+
126+
val event = SentryEvent(RuntimeException(IgnoredForDeduplicationException(deeperCause)))
127+
assertThat(processor.process(event, Hint())).isNotNull()
128+
assertThat(processor.process(event, Hint())).isNull()
129+
}
130+
116131
@Test
117132
fun `ignored exception patterns are matched against the fully qualified class name`() {
118133
val options =

0 commit comments

Comments
 (0)