I'm working with <https://kotlinlang.org/api/kotli...
# coroutines
j
I'm working with https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/receive-catching.html which returns a ChannelResult. ChannelResult can be either succesful result or a failure result. It seems like there are 2 types of failure results. • isClosed is set to true • isClosed is set to false and an exception is available from the https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-channel-result/exception-or-null.html function My question is, for this operation, is it ever possible to get a failure result with isClosed set to false? Why would that ever happen?
j
From the KDoc of `receiveCatching`:
The result cannot be failed without being closed.
j
Ahh so that means it will never happen?
j
Yes.
ChannelResult
is used in other APIs, but in the case of
receiveCatching
this case will never happen