ylemoigne
10/09/2019, 8:33 AMIn 'uncaughtExceptionHandler' ...
is called ?ylemoigne
10/09/2019, 9:35 AMylemoigne
10/09/2019, 9:36 AMunhandled
?Evan R.
10/09/2019, 12:44 PMclose()
(https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-send-channel/close.html):
Attempts to send or receive on a failed channel throw the specified cause exception.It appears that your
produce<String>()
block will just move on to the next iteration after the close()
and attempt to send, re-throwing the exception you closed the channel with. Because there’s no try/catch in the producer it’s being passed up to the CEHEvan R.
10/09/2019, 12:46 PMbreak
in your if statement in the producer will fix the issueylemoigne
10/09/2019, 12:59 PMproduce
doc says Uncaught exceptions in this coroutine close the channel with this exception as a cause and
* the resulting channel becomes _failed_, so that any attempt to receive from such a channel throws exception.
which I understood as throw Something()
in produce block is equivalent to calling close(Something())
but the behavior are differentEvan R.
10/09/2019, 1:47 PMEvan R.
10/09/2019, 1:47 PMylemoigne
10/09/2019, 2:12 PM