~/talk

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

Talkat droidcon Americas 2020 · 2020-11-16..11-17· [kotlin, testing]
links:none on file
slides:none on file

Explains that exceptions in Kotlin coroutines travel the job hierarchy instead of being rethrown, so a try/catch in a parent often misses a failing child; demonstrates fixes using CoroutineExceptionHandler installed on root coroutines, and shows how async/Deferred encapsulates exceptions until await while launch sends them to the root handler. Shows concrete pitfalls: two concurrent async network requests where catching errors prevents sibling cancellation, and a 500ms cancel vs 1000ms delay example that requires rethrowing CancellationException.

AI-written summary · about

  1. 0:00Introduction
  2. 0:57What are Kotlin coroutines
  3. 2:22Basics of exception handling
  4. 4:51Exception handling in coroutines
  5. 6:17Why try-catch fails in coroutines
  6. 7:41Job hierarchy explained
  7. 9:30Coroutine exception handler
  8. 10:13Installing exception handler
  9. 13:29Root coroutines specialties
  10. 14:11Try-catch vs exception handler
  11. 16:17Cancellation mechanism impact
  12. 18:26Problem with try-catch in async
  13. 20:15Catching cancellation exceptions
  14. 22:48Launch vs async differences
  15. 23:31Async root coroutine behavior
  16. 25:38Async as child coroutine
  17. 26:41Coroutine scope scoping function
  18. 27:46Supervisor scope explained
  19. 29:36Supervisor scope exception handling
  20. 30:57Key takeaways recap
  21. 33:04Resources and cheat sheet
  22. 34:30Q&A session
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.