suspendedTryCatchElse
inline suspend fun <T> suspendedTryCatchElse(context: CoroutineContext = Dispatchers.Default, crossinline elseBlock: suspend () -> T, crossinline block: suspend () -> T): T
suspendedTryCatchElse used when you want to return a default value if an exception is thrown in suspend functions.
Example:
suspend fun foo() = suspendedTryCatchElse({ // do else to return a value }) {
// do something to return a value
}
Content copied to clipboard
Since
1.2.0