-
-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure android initialization process continues even if options confi…
…guration block throws an exception (#3887) * Ensure android event processors are added even if options configuration block throws * Changelog
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -517,6 +517,19 @@ class SentryAndroidTest { | |
assertEquals(99, AppStartMetrics.getInstance().appStartTimeSpan.startUptimeMs) | ||
} | ||
|
||
@Test | ||
fun `if the config options block throws still intializes android event processors`() { | ||
lateinit var optionsRef: SentryOptions | ||
fixture.initSut(context = mock<Application>()) { options -> | ||
optionsRef = options | ||
options.dsn = "https://[email protected]/123" | ||
throw RuntimeException("Boom!") | ||
} | ||
|
||
assertTrue(optionsRef.eventProcessors.any { it is DefaultAndroidEventProcessor }) | ||
assertTrue(optionsRef.eventProcessors.any { it is AnrV2EventProcessor }) | ||
} | ||
|
||
private fun prefillScopeCache(cacheDir: String) { | ||
val scopeDir = File(cacheDir, SCOPE_CACHE).also { it.mkdirs() } | ||
File(scopeDir, BREADCRUMBS_FILENAME).writeText( | ||
|