~/talk

Why Exception Handling with Kotlin Coroutines is hard and how to master it

Talkat droidcon EMEA 2020 · 2020-10-08..10-09· [kotlin, testing]
links:none on file
slides:none on file

Kotlin coroutines propagate unhandled exceptions up the job hierarchy, so installing a CoroutineExceptionHandler on a child coroutine does nothing — it must live on the root or scope context; handlers can log but cannot recover because the coroutine already completed exceptionally. launch failures surface immediately, async failures encapsulates exceptions in Deferred and rethrow on await, coroutineScope rethrows child exceptions to callers, supervisorScope isolates siblings, and always rethrow CancellationException or cancellation will be swallowed and work continues unexpectedly.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:18Basics of exceptions
  3. 3:06Exceptions in coroutines
  4. 4:35Why try-catch fails in coroutines
  5. 7:47Coroutine exception handlers
  6. 11:39Try-catch vs exception handlers
  7. 14:08Cancellation and try-catch
  8. 20:38Launch vs async exceptions
  9. 23:27Async child coroutines
  10. 25:17Coroutine scope scoping
  11. 27:05Supervisor scope explained
  12. 29:35Five key takeaways
  13. 32:31Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.