In this lesson, you learned how to handle errors in Kotlin coroutines. You got familiar with SupervisorJobs and CoroutineExceptionHandlers.
The rule of thumb is that the uncaught exception in the child coroutine cancels the parent and all its siblings. This rule isn’t in force when a SupervisorJob is the context of the parent coroutine. Children of such a parent can fail without affecting their parent and other siblings. Take a look at the following cheat sheet:
You can use the CoroutineExceptionHandler to intercept the exceptions that aren’t caught in the coroutines. But you can’t recover from them. You can only use it for diagnostic purposes.
That’s all for this module. See you in the next one!
See forum comments
This content was released on Jun 5 2024. The official support period is 6-months
from this date.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.