https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
a

Ali

04/02/2022, 2:36 PM
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?
a

Arun Joseph

04/03/2022, 8:37 AM
We use https://github.com/michaelbull/kotlin-result to report success, failure to domain layer.
m

Marek Defeciński

04/04/2022, 1:50 PM
so for example could you get IOException at ui layer ?
or you have some domain errors as right class in
Result
?
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.
9 Views