2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Bug 1804115 Catch errors thrown in the error reporter

This commit is contained in:
James Hugman 2023-03-28 18:16:26 +01:00 committed by mergify[bot]
parent f601798684
commit 6974c82888

View File

@ -8,6 +8,7 @@ import android.content.Context
import mozilla.components.service.nimbus.NimbusApi
import mozilla.components.service.nimbus.NimbusAppInfo
import mozilla.components.service.nimbus.NimbusBuilder
import mozilla.components.service.nimbus.loggingErrorReporter
import mozilla.components.service.nimbus.messaging.FxNimbusMessaging
import mozilla.components.service.nimbus.messaging.NimbusSystem
import mozilla.components.support.base.log.logger.Logger
@ -59,9 +60,16 @@ fun createNimbus(context: Context, urlString: String?): NimbusApi {
return NimbusBuilder(context).apply {
url = urlString
errorReporter = { message, e ->
Logger.error("Nimbus error: $message", e)
if (BuildConfig.BUILD_TYPE == "debug") {
Logger.error("Nimbus error: $message", e)
}
if (e !is NimbusException || e.isReportableError()) {
context.components.analytics.crashReporter.submitCaughtException(e)
@Suppress("TooGenericExceptionCaught")
try {
context.components.analytics.crashReporter.submitCaughtException(e)
} catch (e: Throwable) {
loggingErrorReporter(message, e)
}
}
}
initialExperiments = R.raw.initial_experiments