Ciao guys, I found a weird behavior with the `conf...
# coroutines
f
Ciao guys, I found a weird behavior with the
conflate
flow operator and throwables... Basically, when throwing an exception from a
flow
that passes through a conflated operator, the re-thrown exception is different from the original one. It's reproducible with the following code:
Copy code
@Test
fun myTest() = runBlocking {
    val throwable = Throwable()
    try {
        flow<Unit> { throw throwable }.conflate().collect()
    } catch (caught: Throwable) {
        // We expect the same exception that we are throwing 
        assert(throwable === caught) { "Expected $throwable, found $caught" }
        // Prints "Expected java.lang.Throwable, found java.lang.Throwable"
    }
}
The same test without the
.conflate
operator passes. Can you confirm that what I expect is the actual intended behavior and therefore this is a bug? I'm on K
1.7.0
and coroutines
1.6.3
🙏