https://kotlinlang.org logo
#announcements
Title
# announcements
c

coder82

08/19/2019, 11:02 AM
Does the CoroutineExceptionHandler capture also a CancellatioException in the case of launch? What I would like to do is to launch a bunch of coroutines under a SupervisorJob, and I want to, for robustness, relaunch the coroutine if it fails, but not if it's cancelled.
So I was thinking to use CoroutineExceptionHandler to be cleaner.
d

Dico

08/19/2019, 11:20 AM
That should work. Cancellation exceptions are not handled by it, but their cause, if applicable, is.
c

coder82

08/19/2019, 11:25 AM
Untitled.txt
so if i cancel or through a cancel exception manually the handler is not triggered
while other exceptions are caught, which is exactly what I need
so that i can relaunch the coroutine only when it really fails and I haven't caught the exception inside it, just trying to make it very robust and resilient
d

Dico

08/19/2019, 11:47 AM
I think you should only relaunch if specific exceptions occur
c

coder82

08/19/2019, 12:47 PM
u think so? why
l

louiscad

08/19/2019, 12:59 PM
#coroutines