tryCatchElse

inline fun <T> tryCatchElse(elseBlock: () -> T, block: () -> T): T

tryCatchElse used when you want to return a default value if an exception is thrown.

Example:

var num = 0
tryCatchElse(elseBlock = { --num }) {
throw Exception("throw")
num++
} // -1

tryCatchElse(elseBlock = { --num }) {
++num
} // 0

Since

1.1.0