Kotlin & Coroutines (50 Qs)•Part 3: K2 Compiler, KMP, Advanced Metaprogramming & Optimization (25 - 35)
How does Exception Handling work in Coroutines and why does try-catch around launch fail?
senior LevelPerformance
In Simple Words:
launch fires an asynchronous task; exceptions are delivered to the CoroutineExceptionHandler or parent job, not caught by outer synchronous try-catch. Use async with .await() or attach a CoroutineExceptionHandler to capture exceptions.