I read a method like this:
public void doSomething throws MyException{ ... try { doSomthingElse(); } catch (MyException e){ log.errer(e.getMessage()); throw new MyException(e.getMessage(),e); } ... }
But I prefer:
public void doSomething throws MyException{ ... doSomthingElse(); ... }
Does anyone know the reason for the first method? There is only one type of exception, and it is not handled in this method, is there any reason to catch it, wrap it without new information and then pass it on? Why not just write it in the second? Thanks!
exception-handling
chance
source share