https://kotlinlang.org logo
#coroutines
Title
# coroutines
u

uli

06/18/2018, 3:42 PM
Well, I ask, because I expected a `ClosedSendChannelException`on next send operation as is documented in the API docs, but I don't get to the next send operation but get a JobCanceledException before https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-send-channel/close.html
Copy code
A channel that was closed without a cause throws ClosedSendChannelException on attempts to send or receive. A channel that was closed with non-null cause is called a failed channel. Attempts to send or receive on a failed channel throw the specified cause exception.
Documentation for
produce
mentions:
Copy code
The running coroutine is cancelled when its receive channel is cancelled.
But does not talk about the SendChannel being closed
Solved: The Cancelation was actually caused by the consumer closing the ReceiveChannel, triggered by the SendChannel being closed.
2 Views