fix: surface provider bootstrap failures

This commit is contained in:
2026-08-24 09:51:42 +08:00
parent d0ad601efc
commit 6d8f8d3079
@@ -48,6 +48,7 @@ class AppSessionViewModel @Inject constructor(
init { init {
viewModelScope.launch { viewModelScope.launch {
try {
val activeProfile = profileStore.activeProfile() val activeProfile = profileStore.activeProfile()
if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) { if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) {
coordinator.switchProvider() coordinator.switchProvider()
@@ -61,6 +62,18 @@ class AppSessionViewModel @Inject constructor(
result = coordinator.bootstrap(), result = coordinator.bootstrap(),
) )
} }
} catch (error: kotlinx.coroutines.CancellationException) {
throw error
} catch (error: Exception) {
bootstrapResult.value = ProviderBootstrapResult(
profileId = null,
result = DomainResult.Failure(
com.flagship.abox.manager.domain.DomainError.Unknown(
detail = error.message ?: "Unable to load provider settings",
),
),
)
}
} }
viewModelScope.launch { viewModelScope.launch {
coordinator.observeActiveSession() coordinator.observeActiveSession()