Last active
June 26, 2025 19:46
-
-
Save shah-vraj/9d31d6845c38da8d5d5df8f4706e84e8 to your computer and use it in GitHub Desktop.
Using try catch to handle exception in coroutine scope
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
coroutineScope { | |
try { | |
launch { | |
throw RuntimeException("This won't be caught here") | |
} | |
} catch (e: Exception) { | |
println("Caught: ${e.message}") // This won't be triggered | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment