alex.hart
11/15/2017, 2:05 PMsealed class Response {
data class Success(data: Data): Response()
data class Error(code: Int, msg: String): Response()
}
Then, when you perform your retrofit action, you can map whatever happens to the appropriate response.
The trick is to make sure an error never really enters the stream to begin with (as I believe it gets trickier since as soon as you send an error your original stream is going to terminate)viliusk
11/15/2017, 2:11 PMData
, some are returning MembershipDetails
, others - PaymentResponse
alex.hart
11/15/2017, 2:26 PMsealed class Response {
data class Success<T>(data: T): Response()
data class Error(code: Int, msg: String): Response()
}