In what scenarios might `getOrThrow` actually thro...
# coroutines
k
In what scenarios might
getOrThrow
actually throw an exception here?
Copy code
callbackFlow {
  registerSomeCallback { value -> trySend(value).getOrThrow()
}.conflate()
1
j
I guess it depends on the buffer size of the channel. For unlimited channel size it should never throw, and with the
conflate()
here it should also never throw, at least not due to full buffer. Regarding throwing because of the channel being closed, I'm not sure. Cancelling the flow shouldn't close the channel AFAIR but I would need to double check
k
We’re seeing a crash with the code that this psuedocode is derived from, and I want to be able to repro it in a test before I push a new release
e
IIRC there was an issue very early on where the predecessor to
trySend
would throw an exception unexpectedly (or rather expectedly but unintuitively). That's why
trySend
was made, and returns a
Result
k
I was able to reproduce and fix in this PR https://github.com/kevincianfarini/monarch/pull/127/