https://kotlinlang.org logo
#coroutines
Title
# coroutines
n

nikospamp

01/16/2019, 7:03 PM
Hello guys, up until now I've been using rxjava for networking but now I'm trying to change to coroutines. On rx I have a central system that if a certain property on the network response has a certain value it maps it into a custom exception How can I do something like that on coroutines? https://stackoverflow.com/questions/54204547/central-error-handling-in-coroutines-kotlin
g

groostav

01/16/2019, 7:08 PM
I'm not familiar with retrofit, but I'm pretty sure the answers yes. You should be able to drop the monadic types, so
Single.error
becomes simply
throw
,
single.just
becomes simply
return
... but then the monads become interesting. Does kotlinx.coroutines have a nice factory for
CallAdaptor
(similar to
CompletableFuture
)?
d

Dico

01/17/2019, 12:11 AM
Kotlin has CompletableDeferred which is analogous to CompletableFuture. Don't know what CallAdaptor is
5 Views