mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 15:53:40 +00:00
27 lines
463 B
Kotlin
Vendored
27 lines
463 B
Kotlin
Vendored
// IGNORE_BACKEND_FIR: JVM_IR
|
|
inline fun catchAll(x: String, block: () -> Unit): String {
|
|
try {
|
|
block()
|
|
} catch (e: Throwable) {
|
|
}
|
|
return x
|
|
}
|
|
|
|
inline fun tryTwice(block: () -> Unit) {
|
|
try {
|
|
block()
|
|
try {
|
|
block()
|
|
} catch (e: Exception) {
|
|
}
|
|
} catch (e: Exception) {
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
return catchAll("OK") {
|
|
tryTwice {
|
|
throw Exception()
|
|
}
|
|
}
|
|
} |