fix: add default uncaught exception handler
Sometimes a coroutine will crash and nothing gets emitted in logcat, this makes sure to at least show *something*
This commit is contained in:
parent
88e44b1cbb
commit
3a28fe17f8
1 changed files with 7 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import androidx.navigation3.runtime.rememberNavBackStack
|
|||
import androidx.navigation3.runtime.rememberSaveableStateHolderNavEntryDecorator
|
||||
import androidx.navigation3.ui.NavDisplay
|
||||
import androidx.savedstate.serialization.SavedStateConfiguration
|
||||
import co.touchlab.kermit.Logger
|
||||
import dev.zacsweers.metro.createGraph
|
||||
import dev.zacsweers.metrox.viewmodel.LocalMetroViewModelFactory
|
||||
import kotlinx.serialization.Serializable
|
||||
|
|
@ -18,6 +19,7 @@ import kotlinx.serialization.modules.polymorphic
|
|||
import moe.lava.neon.ui.di.AppUiGraph
|
||||
import moe.lava.neon.ui.screens.Login
|
||||
import moe.lava.neon.ui.screens.Sample
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
private object Route {
|
||||
@Serializable
|
||||
|
|
@ -38,6 +40,11 @@ private val config = SavedStateConfiguration {
|
|||
|
||||
@Composable
|
||||
fun App() {
|
||||
Thread.setDefaultUncaughtExceptionHandler { t: Thread, e: Throwable ->
|
||||
Logger.withTag("neon.thrhandler").a("Uncaught from $t: ${e}\n${e.stackTraceToString()}", e)
|
||||
exitProcess(1)
|
||||
}
|
||||
|
||||
val uiGraph = createGraph<AppUiGraph>()
|
||||
val graph = uiGraph.core
|
||||
CaptchaBinder(graph.api)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue