We are following MVC pattern - model view controller and flow is
Controller -> Service -> Dao -> JdbcTemplate -> MySQL
1. All the errors should be cached and thrown in controller layer ? (OR) Error should be thrown from the controller method and it should be handled in the front end - js or jsp files ?
2. Do we need to catch DAO exception in the service layer or just pass the thrown exception to the controller layer and let the controller handle the exception?
3. Customized exception can be thrown on DAO and in service layer. However does the final exception handling should be done in controller side or in service layer.
4. Does the controller should catch any exception and create the localized error message and just pass the error message as string and response type as error to the front end to handle the error in the front end ?