Coroutine Exceptions & Error Handling

KOTLIN › Coroutines

How failure travels through the job hierarchy, and which tool catches it where.

Coroutine error handling confuses people because an exception in a coroutine is a failure of its Job, not an exception at the call site that started it. Interviewers use this to check whether you understand the job hierarchy: why try/catch around launch never fires, exactly where a CoroutineExceptionHandler is consulted, why async behaves differently, and why CancellationException is exempt from all of it. Strong answers treat the handler as a last-resort crash reporter and put recoverable failures in a Result or a typed catch where the code that can respond will see them.

What this covers

Study this topic

Further reading