Java Message handling in Service Layer
Posted on 2016-10-13
I´m designing a service layer in a multilayerd architecture (Service, Business, Dao). Suposse I need a method like getUserAccounts
This method just return a list of Accounts, but what if my dao layer can´t connect to database, or if I have some error when reading the recorset, a parse problem for example. Or maybe another error in the business layer.
Do I have to catch the exception in the service layer, and map to a error code?
Do I have to catch the exception in the business layer, and the buisness layer return a bean with the error code? Avoiding to have any kind of logic in the service layer, more than exposing the Rest API