I have a `ReceiveChannel` that the caller can use ...
# coroutines
s
I have a
ReceiveChannel
that the caller can use to receive data sent from repeated callback. If something goes wrong, the
Channel
implementing the returned
ReceiveChannel
is closed with a
Throwable
. How can I catch this throwable? I can’t find a method on a
ReceiveChannel
that takes a callback function to handle a side-effect of closing a channel (with or without an error).
e
Can you use a try-catch-finally pattern to route events the way you expect?
s
Nope, only thing I have is a
ReceiveChannel
and I’d like to intercept any closing of the channel, whether it be with an error or just plain closing.
r
How about checking
isActive
?
s
Thank you. I can't check or poll (for the
isActive
status). The code needs a callback when the channel is being closed (with or without error).