your API call should then return an object that wr...
# rx
z
your API call should then return an object that wraps the two possible outcomes.
Copy code
data class ApiResponse(val data: String?, val error: Exception?) {
    val isSuccessful = data != null
}
With Kotlin 1.1, you can leverage sealed classes alongside data classes, so you can have a nice
when
statement for the two possible outcomes.