CLOVIS
04/17/2021, 12:41 PMSupervisorJob
, how can I stop all its children without an exception? If I use supervisorJob.cancel()
, an exception is thrown.Adam Powell
04/17/2021, 1:40 PMlouiscad
04/17/2021, 3:00 PMCLOVIS
04/17/2021, 3:58 PMAdam Powell
04/17/2021, 4:04 PMlouiscad
04/17/2021, 4:19 PMcancel()
? What is its message?Zach Klippenstein (he/him) [MOD]
04/19/2021, 12:20 PMcancel()
itself, that seems odd. If the exception is thrown from somewhere in the cancelled coroutines, and it’s a CancellationException
, that’s what Adam is talking about, and is how the coroutine cancellation mechanism is designed. The proper thing to do from coroutines is to pass `CancellationException`s through (either don’t catch them at all, or if you do catch them, rethrow them immediately).CLOVIS
04/19/2021, 1:32 PM