Created
July 7, 2021 11:44
-
-
Save adesamp/fe3461a12a3d950f6c57baaaede38f0e to your computer and use it in GitHub Desktop.
exceptionHandlingWIthTryCatch.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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