ylemoigne
09/30/2019, 7:46 AMchannelFlow
, and a simple flow created with flowOf
. I want to concatenate them so I do val concatened = chanFlow.onCompletion { if(it==null) emitAll(simpleFlow) }
. Then the flow is "launched" GlobalScope.launch { concatened.collect { ... } }
. When I cancel the resulting job, the chanFlow stop correctly and throw CancellationException
, but the second flow values are still collected. The throwable
in onCompletion
is null. What is the correct way to handle this ?Paul Woitaschek
09/30/2019, 7:58 AMylemoigne
09/30/2019, 8:02 AMVsevolod Tolstopyatov [JB]
09/30/2019, 9:56 AMonCompletion
documentation).
You can use if (it == null && coroutineContext.isActive)
to ignore cancellation as wellylemoigne
09/30/2019, 10:56 AM