Is there a good reason why `SendChannel.offer` thr...
# coroutines
d
Is there a good reason why
SendChannel.offer
throws instead of returning
false
? If so, why is there not an equivalent that never throws?
v
Not really, initially it was done only to be consistent with
send
. We are thinking of changing that in #974
If so, why is there not an equivalent that never throws?
Unfortunately, no, because we have a compiler problems related to inline classes. You can write your own extension with an optimistic
isClosedForSend
check +
try { ... } catch { ... }
also, please write your use-case in #974 for this behaviour. The more information we have, the better solution we can implement