In the Android architecture guide for the data layer, the usage of exceptions instead of a Result<T> class is recommended.
For errors that could be triggered by suspend functions, use try/catch blocks when appropriate; and in flows, use the catch operator. With this approach, the UI layer is expected to handle exceptions when calling the data layer.
In contrast to a Result<T> class I can't quite imagine how it would work with exceptions - how would I handle exceptions in the UI layer / Jetpack Compose? Are there any full examples for this? I just checked the Sunflower sample app linked in the guide but it seems not to have any network error handling at all.
Flowis cancelled if an exception propagates, so it's not that useful to catch it at an high level (ViewModellevel in my case). Details in stackoverflow.com/questions/75961806/… Maybe you can have a look there too :-)