Hi everyone,
I've been developing a project at work and applying a clean architecture approach. I'm trying to keep my different layers in separate components. I find that it helps understand where things are. I've got my project decoupled in 3 major components right now.
Presentation component (presentation logic)
Data component (data access / gateway here)
Domain component (interactors here)
In this setup the Domain component doesn't depend on anything. It declares interfaces which are implemented by the Data component. Therefore the Data component and the Presentation component depends on the Domain component.
The issue I'm having is with declaring my Exceptions. I'm not sure if I'm even doing this right but there's cases where I'd like my Interactors to catch exceptions and take appropriate actions. But those Exceptions would be specific to the Data component such as VoiceServiceUnavailableException. How do I declare those exception in the Data component without having my Domain component depend on it?
I'm very familiar with Inversion of Control and I apply it in the Domain component to make sure that this component doesn't have any dependencies on other components. But because it's the one declaring the interfaces and the implementations are found in the Data component, should it also be the one to declare the exceptions its expecting to receive from those interfaces? Seems kinda odd to me or perhaps it makes perfect sense, I'm not sure.
I feel like I might be missing something important here.