У меня есть пара методов в dao
файле, связанном с DB operations
.like
public int addStudent(Student student) throws MyAppException, SQLException {
// adding student in db
}
И в моем controller
я использую как
try{
myObj.addStudent(student);
}catch(Exception e){
Alert alert = new Alert(AlertType.ERROR, e.getMessage());
alert.showAndWait();
}
IЯ могу показывать диалоговые сообщения на Error
, но хочу обрабатывать в одном месте вместо каждого catch clause
, что-то вроде
public void myGlobalCatchhandler(Exception e){
Alert alert = new Alert(AlertType.ERROR, e.getMessage());
alert.showAndWait();
}
в одном месте, вставленном в каждое предложение catch блока try.