1 min readOct 31, 2016
Hey Kristian. That’s a good point. One way to do this is to encapsulate the possible error/success states in a Response<Data>
object. This way, the consumer will can check whether there is an error before trying to access the data. Here’s a good example: https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/Response.java