I implemented my own custom exception. I do not want it to print the exception on the framework console. Is it possible?
May 15, 2017 2: 47: 24 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet[project - services] in context with path[/project-services] threw exception [Request processing failed; nested exception is ba.project.exception.TAException: There is no any tour activity between selected dates.] with root cause ba.project.exception.TAException: There is no any tour activity between selected dates.at ba.project.service.TAServices.findByTourTypeWithDates(TAServices.java: 94)
Custom Exception:
public class TAException extends RuntimeException {
private static final long serialVersionUID = 1 L;
public TAException(String msg) {
super(msg);
}
public TAException(String msg, Throwable e) {
super(msg, e);
}
}
Here is how I throw exception:
public List < Object > findByTourTypeWithDates(String tourType, Date checkin, Date checkout)
throws ParseException, TAException {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = dateFormatter.parse(dateFormatter.format(new Date()));
if (checkin.after(todayDate)) {
return taDAO.findByTourTypeWithDates(tourType, checkin, checkout);
}
throw new TAException("There is no any tour activity between selected dates.");
}