Many times you need to catch one type of exception and then throw another one without losing information of first exception. In that case chained exceptions are used.
Code:public void myMethod() throws MyException{
try {
// write your code here
} catch(YourException e) {
throw new MyException(e);
}
}
