Diefferson
11/28/2018, 1:12 PMuzzu
11/28/2018, 1:50 PMrunCatching ?
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.html
You can use it as below:
//In your class that extends CoroutineScope
fun getUser() {
launch {
runCatching { userRepository.getUser() }
.onSuccess { /**/ }
.onFailure { /**/ }
}
}Diefferson
11/28/2018, 3:26 PMDiefferson
11/28/2018, 3:29 PMuzzu
11/28/2018, 4:54 PMrunCatching to replace ResultAsync<T> (in your gists) to Result<T>.