fix: surface provider bootstrap failures
This commit is contained in:
+22
-9
@@ -48,17 +48,30 @@ class AppSessionViewModel @Inject constructor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val activeProfile = profileStore.activeProfile()
|
try {
|
||||||
if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) {
|
val activeProfile = profileStore.activeProfile()
|
||||||
coordinator.switchProvider()
|
if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) {
|
||||||
|
coordinator.switchProvider()
|
||||||
|
bootstrapResult.value = ProviderBootstrapResult(
|
||||||
|
profileId = null,
|
||||||
|
result = DomainResult.Success(null),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
bootstrapResult.value = ProviderBootstrapResult(
|
||||||
|
profileId = activeProfile?.id,
|
||||||
|
result = coordinator.bootstrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} catch (error: kotlinx.coroutines.CancellationException) {
|
||||||
|
throw error
|
||||||
|
} catch (error: Exception) {
|
||||||
bootstrapResult.value = ProviderBootstrapResult(
|
bootstrapResult.value = ProviderBootstrapResult(
|
||||||
profileId = null,
|
profileId = null,
|
||||||
result = DomainResult.Success(null),
|
result = DomainResult.Failure(
|
||||||
)
|
com.flagship.abox.manager.domain.DomainError.Unknown(
|
||||||
} else {
|
detail = error.message ?: "Unable to load provider settings",
|
||||||
bootstrapResult.value = ProviderBootstrapResult(
|
),
|
||||||
profileId = activeProfile?.id,
|
),
|
||||||
result = coordinator.bootstrap(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user