I'm using a layered architecture.
- Presentation Layer
- Service Layer (Business Layer)
- Domain Layer (where my domain entities reside)
- Dao Layer
My problem is:
How can I handle exceptions using the Error Dialog Pattern. My professor said, if my MVC Controller resides into the Presentation Layer (this is my case, I'm using JavaSwing), then the Error Dialog class can resides into the Domain Layer (my Service Layer I think).
But I have doubts:
Error Dialog Patterns seems to dialog with the Presentaion Layer through a Class/Interface that belongs to Presentaiton Layer. Shouldn't be the Presentaion Layer itself the only one working on objects of the Presentation Layer? It seems strange to me when my Controller creates, for example, a JPanel and passes it to the Error Dialog Class that resides into the Service Layer.
This is my ErrorService Class that resides into the Service Layer and interacts with INotifier, Interface implemented by a Presentation Layer Class:
public class ErrorsService {
private static ErrorsService instanceErrorsService;
private INotifier notifier;
private ErrorsService(INotifier notifier) {
this.notifier = notifier;
};
public static ErrorsService getErrorsServiceIstance(INotifier notifier) {
if (instanceErrorsService == null) {
instanceErrorsService = new ErrorsService(notifier);
}
return instanceErrorsService;
}
public void errorNotify(Exception exception) {
notifier.notify(exception.getStackTrace().toString());
}