mc
07/05/2019, 1:07 PMfun <R> (suspend () -> R).fallbackTo(block: () -> R) : suspend () -> R = {
try {
this()
} catch (e: Exception) {
block()
}
}
fun <T1, R> (suspend (T1) -> R).fallbackTo(block: (T1) -> R) : suspend (T1) -> R = { t1 ->
try {
this(t1)
} catch (e: Exception) {
block(t1)
}
}
fun <T1, T2, R> (suspend (T1, T2) -> R).fallbackTo(block: (T1, T2) -> R) : suspend (T1, T2) -> R = { t1, t2 ->
try {
this(t1, t2)
} catch (e: Exception) {
block(t1, t2)
}
}
Dominaezzz
07/05/2019, 1:10 PMtry
and catch
.mc
07/05/2019, 2:17 PM