-
-
Save thomaskioko/23a18e2d62f61fcb43af9c2f437b25f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
fetcher = Fetcher.of { | |
val apiResponse = remoteDataSource.getPopularShows(page = 1) | |
when (apiResponse) { | |
is ApiResponse.Success -> { | |
// Map and cache data to local-source. | |
} | |
is ApiResponse.Error.HttpError -> throw Throwable("${response.errorMessage}") | |
is ApiResponse.Error.GenericError -> throw Throwable("${response.errorMessage}") | |
is ApiResponse.Error.SerializationError -> throw Throwable("${response.errorMessage}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment