util: correctly throw channel errors
Wasn't being properly handled before, leading to weird behavior.
This commit is contained in:
parent
ed519eeccc
commit
77f0bbe614
1 changed files with 1 additions and 1 deletions
|
@ -186,7 +186,7 @@ suspend fun <E> ReceiveChannel<E>.forEachWithTimeout(
|
|||
var subsequent = false
|
||||
val handler: suspend () -> Unit = {
|
||||
val value = receiveCatching()
|
||||
if (value.isClosed) {
|
||||
if (value.isClosed && value.exceptionOrNull() == null) {
|
||||
exhausted = true
|
||||
} else {
|
||||
action(value.getOrThrow())
|
||||
|
|
Loading…
Reference in a new issue