https://kotlinlang.org logo
#getting-started
Title
# getting-started
r

Rodrigo Silva

06/24/2022, 3:48 AM
Is there any way to force a failure in the
runCatching
block like:
Copy code
runCatching {
     when (some_condition) {
         1 > failure
         else -> todo
}
y

Youssef Shoaib [MOD]

06/24/2022, 7:04 AM
Use the
error()
function from the stdlib, with an optional message.
3 Views