Where should one handle the exceptions thrown from the external SDK ? Should it be handled in data sources or repo ?
06/23/2022, 2:05 PM
This is not an answer; but when I have this dilemma I usually ask the question: Which layer absolutely needs to have a dependency on the external SDK? That is the layer that I prefer to handle the exceptions.
To give you an example, in my architecture I do not have separate layers for data sources and repo - instead they are merged into one layer (the "Data layer").
I also have a domain layer that has no external SDK dependencies. So my data later handles exceptions and if needed "translates" them into domain-specific errors
07/06/2022, 4:27 PM
When we have repo and datasource. Repository have dependency on RemoteDataSource and LocalDataSource. In such cases I would prefer to have exception handle in the datasource.