Skip to content

Commit

Permalink
Add support for ignoredErrors option in Manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
lcian committed Jan 30, 2025
1 parent 2fc1ed7 commit 867cfbe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ final class ManifestMetadataReader {

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

static final String IGNORED_ERRORS = "io.sentry.ignored-errors";

/** ManifestMetadataReader ctor */
private ManifestMetadataReader() {}

Expand Down Expand Up @@ -401,6 +403,8 @@ static void applyMetadata(
options
.getSessionReplay()
.setMaskAllImages(readBool(metadata, logger, REPLAYS_MASK_ALL_IMAGES, true));

options.setIgnoredErrors(readList(metadata, logger, IGNORED_ERRORS));
}

options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.os.Bundle
import androidx.core.os.bundleOf
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.sentry.FilterString
import io.sentry.ILogger
import io.sentry.SentryLevel
import io.sentry.SentryReplayOptions
Expand Down Expand Up @@ -1427,4 +1428,17 @@ class ManifestMetadataReaderTest {
// Assert
assertEquals(100, fixture.options.maxBreadcrumbs)
}

@Test
fun `applyMetadata reads ignoredErrors to options and sets the value if found`() {
// Arrange
val bundle = bundleOf(ManifestMetadataReader.IGNORED_ERRORS to "Some error,Another .*")
val context = fixture.getContext(metaData = bundle)

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertEquals(listOf(FilterString("Some error"), FilterString("Another .*")), fixture.options.ignoredErrors)
}
}

0 comments on commit 867cfbe

Please sign in to comment.