Created
November 17, 2021 20:01
-
-
Save murattuzel/18a9e7ba8de123ccd15d61604c5060ce 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
class FetchMoviesUseCase( | |
private val dataSource: MovieRemoteDataSource | |
) { | |
suspend operator fun invoke(): Result<MoviesResponse> = | |
withContext(Dispatchers.IO) { | |
try { | |
Result.success(dataSource.fetchMovies()) | |
} catch (exception: IOException) { | |
Result.failure(exception) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment