Skip to content

Instantly share code, notes, and snippets.

@adesamp
Created July 7, 2021 11:44
Show Gist options
  • Save adesamp/fe3461a12a3d950f6c57baaaede38f0e to your computer and use it in GitHub Desktop.
Save adesamp/fe3461a12a3d950f6c57baaaede38f0e to your computer and use it in GitHub Desktop.
exceptionHandlingWIthTryCatch.kt
@Test
fun `direct throw exception in launch with try-catch`() {
runBlocking {
val job = launch {
println("start job")
throw IllegalArgumentException("throw IllegalArgumentException from launch")
}
try {
job.join()
} catch (e: IllegalArgumentException) {
println("catch error : ${e.message}")
}
println("finish")
}
}
//false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment