Hey Guys,
I would like to know your opinion and suggestions on how you handle errors(Network, API, Database, Parsing etc) passing from the data layer to the UI layer in your android clean architecture app?
but Resource had throwable inside and we had a lot of domain specific errors also
+ Resource.Error is really unfortunate name
a
Ali
04/04/2022, 8:09 PM
Thanks for sharing this. But this is mostly mapping between domain and UI layer. How about mapping the error/exception happens in data layer (Network, API, Database, Parsing etc)
c
curioustechizen
04/05/2022, 10:08 AM
The library shared by @Arun Joseph is suitable for mapping between data layer and domain. Basically you catch exceptions in data layer and map it in a a domain-specific failure class. Then you wrap it in an Err before returning it to your domain.