title: Multiple Retrofit calls with Flow
body: <p>I made app where user can add server (recycler row) to favorites. It only saves the IP and Port. Than, when user open <code>FavoriteFragment</code> Retrofit makes calls for each server</p>
  <pre><code> @GET(&quot;v0/server/{ip}/{port}&quot;)
      suspend fun getServer(
          @Path(&quot;ip&quot;) ip: String,
          @Path(&quot;port&quot;) port: Int
      ): Server
  </code></pre>
  <p>So in <code>repository</code> I mix the sources and make multiple calls:</p>
  <pre><code>suspend fun getFavoriteServersToRecyclerView(): Flow&lt;DataState&lt;List&lt;Server&gt;&gt;&gt; = flow {
          emit(DataState.Loading)
          try {
              val getFavoritesServersNotLiveData = favoritesDao.getFavoritesServersNotLiveData()
              val list: MutableList&lt;Server&gt; = mutableListOf()
              getFavoritesServersNotLiveData.forEach { fav -&gt;
                  val server = soldatApiService.getServer(fav.ip, fav.port)
                  list.add(server)
              }
              emit(DataState.Success(list))
          } catch (e: Exception) {
              emit(DataState.Error(e))
          }
      }
  </code></pre>
  <p>and then in <code>ViewModel</code> I create <code>LiveData</code> object</p>
  <pre><code>fun getFavoriteServers() {
          viewModelScope.launch {
              repository.getFavoriteServersToRecyclerView()
                  .onEach { dataState -&gt;
                      _favoriteServers.value = dataState
                  }.launchIn(viewModelScope)
          }
      }
  </code></pre>
  <p>And everything works fine till the Favorite server is not more available in the Lobby and the Retrofit call failure.
  My question is: how to skip the failed call in the loop without crashing whole function.</p>