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
|
var subsequent = false
|
||||||
val handler: suspend () -> Unit = {
|
val handler: suspend () -> Unit = {
|
||||||
val value = receiveCatching()
|
val value = receiveCatching()
|
||||||
if (value.isClosed) {
|
if (value.isClosed && value.exceptionOrNull() == null) {
|
||||||
exhausted = true
|
exhausted = true
|
||||||
} else {
|
} else {
|
||||||
action(value.getOrThrow())
|
action(value.getOrThrow())
|
||||||
|
|
Loading…
Reference in a new issue