Hi everyone!
I'm studying best pratices in exceptions handling to improve the quality of our code here in the organization, but it's a tricky topic and sometimes I don't know what direction to take,
We use JavaFX.
I'm thinking in always throwing the exceptions from the under methods and catch these exceptions in the controllers classes(the top layer), it's a good pratice?
e.g.
Class LoginController have the login() method.
Inside login(), there are the startSession() method.
startSession() method signature throws Exception1 and Exception2 (both checked exceptions)
login() method signature also throws Exception1 and Exception1
I do like this:
try {
login();
}
catch (Exception1 | Exception2 ex) {
throw new RuntimeException("A problem occurred!");
}
It's a good pratice to go in this way?
Thanks!