diff --git a/compose-remote-layout-router/src/commonMain/kotlin/com/utsman/composeremote/router/RemoteRouter.kt b/compose-remote-layout-router/src/commonMain/kotlin/com/utsman/composeremote/router/RemoteRouter.kt index fe70921..cd754b9 100644 --- a/compose-remote-layout-router/src/commonMain/kotlin/com/utsman/composeremote/router/RemoteRouter.kt +++ b/compose-remote-layout-router/src/commonMain/kotlin/com/utsman/composeremote/router/RemoteRouter.kt @@ -4,6 +4,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch @@ -129,6 +130,9 @@ internal class ResultRemoteRouterImpl( scope.launch { fetcher.fetchLayoutAsFlow(url) + .catch { + _layoutContent.value = ResultLayout.failure(it) + } .collectLatest { result -> _layoutContent.value = result calculateIsRoot()