diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt index b7bc121b..be3931ef 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt @@ -18,6 +18,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map @@ -25,6 +26,7 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn import kotlinx.datetime.Instant import me.tatarka.inject.annotations.Inject +import org.lighthousegames.logging.logging class AboutViewModel @Inject constructor( private val dateHandler: DateHandler, @@ -53,6 +55,9 @@ class AboutViewModel @Inject constructor( .onEach { _about.value = it } + .catch { + log.warn(it) { "Error getting server info" } + } .launchIn(scope) } @@ -68,4 +73,8 @@ class AboutViewModel @Inject constructor( private fun getFormattedDate(time: Instant): String { return dateHandler.dateTimeFormat(time) } + + companion object { + private val log = logging() + } }