Just don't catch the exception in the first place and change the method declaration so that it can propagate them:
public void myMethod() throws ExceptionType1, ExceptionType2 {
If you need to take some action and then distribute it, you can change it:
public void myMethod() throws ExceptionType1, ExceptionType2 { try {
Here, ExceptionType2 is not caught at all - it will just propagate automatically. ExceptionType1 captured, logged, and then returned.
It is not recommended to have catch blocks that simply reduce the exception β unless there is some subtle reason (for example, to prevent the use of a more general catch block), you usually should simply remove the catch block.
Jon skeet
source share