1
0
Fork 0

For #2738 - Re-throws exceptions to send better data into the crash reporters

master
Jeff Boek 2019-05-29 12:44:03 -07:00
parent f142be8c92
commit 6527e05405
1 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,7 @@ package org.mozilla.fenix
import android.annotation.SuppressLint
import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import io.reactivex.plugins.RxJavaPlugins
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@ -38,6 +39,7 @@ open class FenixApplication : Application() {
override fun onCreate() {
super.onCreate()
setupApplication()
}
@ -49,6 +51,7 @@ open class FenixApplication : Application() {
setDayNightTheme()
val megazordEnabled = setupMegazord()
setupLogging(megazordEnabled)
registerRxExceptionHandling()
setupCrashReporting()
if (!isMainProcess()) {
@ -65,6 +68,14 @@ open class FenixApplication : Application() {
}
}
private fun registerRxExceptionHandling() {
RxJavaPlugins.setErrorHandler {
it.cause?.run {
throw this
} ?: throw it
}
}
/**
* Wait until all experiments are loaded
*