Evgeniy Zaharov
06/20/2018, 3:19 PMlaunch
to async
and join
to await
everything start to work as expect, I see all three catch (as described in https://github.com/Kotlin/kotlinx.coroutines/issues/61). But with launch
its very strange that method-catch
doesn’t callcodyoss
06/20/2018, 4:05 PMEvgeniy Zaharov
06/20/2018, 4:33 PMlaunch
, about why it’s don’t catched from not suspend methodcodyoss
06/20/2018, 5:12 PMVsevolod Tolstopyatov [JB]
06/20/2018, 5:24 PMlaunch
is equivalent of running a thread in coroutines world.
When you write
val thread = thread { throw Exception() }
thread.join()
You don’t expect for join
to throw, do you?
Same about launch
.
But async
returns Deferred
, which is analogue of the Future
in coroutines world.
And future.get
throws an exception if related computation failed with exceptionlaunch
is fire-and-forget job, while async
is asynchronous computation which should return its result at some pointEvgeniy Zaharov
06/20/2018, 5:52 PMuli
06/20/2018, 11:01 PMVsevolod Tolstopyatov [JB]
06/22/2018, 9:52 AMuli
06/22/2018, 1:13 PM