-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why? And what about failures? #8
Comments
Since is a suspend function, inside Resource.success you are callind the API which is another suspend function, any exceptions thrown by that call in the Resource.Success will propagate the error to the catch block in the viewmodel |
But why use callbackFlow, and why make it a Flow at all? |
And why wrap into Resource.Success if you don't wrap it in unsuccessful cases? |
The reason of using callbackFlow there is that in this repo CocktailApp/app/src/main/java/com/g/tragosapp/domain/DefaultCocktailRepository.kt Line 30 in 5506f6e
About the failure, is beign handled in the viewmodel when that success operation returns an exception, it will be propagated to the viewmodel catch block of the calling function |
Any improvements in the code will be more than welcome @LouisCAD 💯 |
https://github.com/gastsail/CocktailApp/blob/65f3a9c776cf096a5572c52cc502a38c106b1b1d/app/src/main/java/com/g/tragosapp/data/remote/NetworkDataSource.kt#L18-27
The text was updated successfully, but these errors were encountered: