I was trying to keep coroutine related code away f...
# coroutines
m
I was trying to keep coroutine related code away from the presenter, but let me try your thing
k
I don't think there is much you can do without introducing coroutine in the presentation layer. Since suspension can only happen within a coroutine context. Avoiding it means you either have to block somehow, or go back to the regular async+callback way
m
yeah, that's the same conclusion I arrived to
👍 1
when are you handling exceptions? when awaiting, I assume?
k
Yes. You can do that. It gets tricky though, because cancellation exceptions could also get thrown, which you shouldn't be handling. The framework knows how to deal with that. So, I wrap all results, both success and exception, and leave any other exceptions (ideally cancellation) for the framework to handle
You can checkout the retrofit coroutines library's
awaitResult