void methodWithException() throws Exception {
try {
throw new Exception("test exception");
}
catch (Exception e) {
//Любая частичная обработка
//и передача ошибки вызывающему коду
throw e;
}
}
try {
methodWithException();
}
catch (Exception e) {
System.out.println(e.getMessage());
}