what is the equivalent of `onErrorContinue` in ko...
# coroutines
t
what is the equivalent of
onErrorContinue
in kotlin flow?
t
my use case is little bit different here. if an exception in any flow operator, skip the next operator for the elements and continue the pipeline for subsequent elements.
Copy code
fun main() = runBlocking {

    val ints = flow {
        // flow builder
        for (i in 1..10) {
            delay(100)
            emit(i) // emit next value
        }
    }

    ints.map {
        if (it == 5) throw IllegalArgumentException("throwing exception")
        it * 2
    }.catch {
        println("caught exception") // if any exception, don't process the next operator in the pipeline and continue the next subsequent element in the flow.
    }.collect {
        println("received $it")
    }
}
d
Ah! This use case. I'll find you a link.
t
nice 👍 Thanks 🙏