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

gildor

02/23/2017, 1:10 PM
might make sense to create a wrapping class that encapsulates the error / sucess
@Paul Woitaschek I use this approach for my coroutine wrapper for Retrofit: https://github.com/gildor/kotlin-coroutines-retrofit#awaitresult
.await
returns sealed class Result
p

Paul Woitaschek

02/23/2017, 1:52 PM
gildor: It might make sense to change all your
T
T : Any
g

gildor

02/24/2017, 1:21 AM
I think
T : Any
make sense for RxJava2, where you cannot use
null
as result, but for Retrofit you can easily write an adaptor that returns something in one case and null in another, actually even
json
allow you to use null as top level answer. So <T : Any> can broke some use cases
5 Views