I have a three-layer structure
1. Presentation level
2. Business level
3. Data
level The presentation level interacts with the business level using the service facade. Now I am confused about where I should use my exceptions, where I should write them down and where I should catch and internalize them. I am currently swallowing my exception at my presentation level after logging, while I am registering and throwing them everywhere. This causes the exception to be thrice recorded. This is not a big concern, but I would like to know how to do it.
For example: Presentation level code:
try
{
UserService.GetAllUsers() ;
}
catch(Exception ex )
{
Logger.log(ex)
}
UserService Layer Code
try
{
IUserDAO userDAO = ServiceRegistry.GetRegistry().GetDAOFactory().GetUserDAO() ;
return userDao.GetAllUsers() ;
}
catch ( Exception ex)
{
Logger.log(ex) ;
throw;
}
DAOLayer Code
try
{
}
catch(Exception ex)
{
Logger.log(ex)
throw ;
}