dave08
10/18/2018, 3:43 PMproduce { }
that sends download status to a notification service, so if there's an exceoption I'd like to be able to send an error message. It looks like try { } catch() { }
is unreliable (https://github.com/Kotlin/kotlinx.coroutines/issues/361), and installing a CoroutineExceptionHandler
on produce
I won't be able to get to its channel to report status... is there any better way to do this?Vsevolod Tolstopyatov [JB]
10/18/2018, 3:58 PMproduce
already does what you want:
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.
Vsevolod Tolstopyatov [JB]
10/18/2018, 3:59 PMproduce
has the same lifecycle as its channel