I want to catch an Error in springMVC3 using exception handler. I annotated the exception. I can catch throwable and any exception. But when I tried with Error, It is not catching the exception. Any idea why it is so? The below code catches exceptions
ExceptionHandler(InvalidDataException.class)
public ModelMap handleException(InvalidDataException ex) {
logger.debug("exception catched :" + ex);
return new ModelMap();
}
But the below is not catching;
@ExceptionHandler(Error.class)
public ModelMap handleException(Error ex) {
logger.debug("exception catched :" + ex);
return new ModelMap();
}