Skip to content

Commit 4c80d9e

Browse files
authored
Add support for ignoredErrors option in manifest (#4178)
* Add support for `ignoredErrors` option in Manifest * changelog
1 parent 883b995 commit 4c80d9e

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- The `ignoredErrors` option is now configurable via the manifest property `io.sentry.traces.ignored-errors` ([#4178](https://github.com/getsentry/sentry-java/pull/4178))
8+
59
### Fixes
610

711
- `SentryOptions.setTracePropagationTargets` is no longer marked internal ([#4170](https://github.com/getsentry/sentry-java/pull/4170))

sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ final class ManifestMetadataReader {
105105

106106
static final String MAX_BREADCRUMBS = "io.sentry.max-breadcrumbs";
107107

108+
static final String IGNORED_ERRORS = "io.sentry.ignored-errors";
109+
108110
/** ManifestMetadataReader ctor */
109111
private ManifestMetadataReader() {}
110112

@@ -400,6 +402,8 @@ static void applyMetadata(
400402
options
401403
.getSessionReplay()
402404
.setMaskAllImages(readBool(metadata, logger, REPLAYS_MASK_ALL_IMAGES, true));
405+
406+
options.setIgnoredErrors(readList(metadata, logger, IGNORED_ERRORS));
403407
}
404408

405409
options

sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.os.Bundle
55
import androidx.core.os.bundleOf
66
import androidx.test.ext.junit.runners.AndroidJUnit4
7+
import io.sentry.FilterString
78
import io.sentry.ILogger
89
import io.sentry.SentryLevel
910
import io.sentry.SentryReplayOptions
@@ -1433,4 +1434,17 @@ class ManifestMetadataReaderTest {
14331434
// Assert
14341435
assertEquals(100, fixture.options.maxBreadcrumbs)
14351436
}
1437+
1438+
@Test
1439+
fun `applyMetadata reads ignoredErrors to options and sets the value if found`() {
1440+
// Arrange
1441+
val bundle = bundleOf(ManifestMetadataReader.IGNORED_ERRORS to "Some error,Another .*")
1442+
val context = fixture.getContext(metaData = bundle)
1443+
1444+
// Act
1445+
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
1446+
1447+
// Assert
1448+
assertEquals(listOf(FilterString("Some error"), FilterString("Another .*")), fixture.options.ignoredErrors)
1449+
}
14361450
}

0 commit comments

Comments
 (0)