Can anyone explain to me why coroutine exception h...
# coroutines
s
Can anyone explain to me why coroutine exception handling is treated differently between Job and Deferred? Doesn't initially make sense to me why this is desired: https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/exception-handling.md
v
what exactly confuses you?
launch
is fire-and-forget computation without a result. If it is failed, no one will ever know about it, so it should be reported somewhere (to exception handler). Meanwhile
async
is not fire-and-forget. It is a computation with result which should be consumed. And if it will be consumed, then exception will be eventually delivered and handled. And if someone called
async
and haven’t called
await
it is probably a bug.
s
that makes sense. I just needed someone to explain it. Thanks