Kotlin Coroutines: Fundamentals

Feb 14 2024 · Kotlin 1.9, Android 13, Android Studio Giraffe

Part 2: Deep Dive into Coroutines

10. Handle Exceptions in Coroutines

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 09. Deep Dive into Async/Await Next episode: 11. Challenge: Implement a Coroutine Bound to Composable with Exception Handling

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Welcome to the tenth episode of the course! This is the last episode before the final challenge! :]

scope.launch {
  async {
    Log.d(
      "ErrorHandlingScreen",
      "Coroutine inside async on thread: ${Thread.currentThread().name}",
    )
    throw Exception("async went wrong")
  }
}
val scope = CoroutineScope(
  CoroutineName("ErrorHandlingScreen") +
          SupervisorJob() + CoroutineExceptionHandler { _, throwable ->
      Log.e("ErrorHandlingScreen", "Exception handler", throwable)
  })