/** * One stop shopping for exception handling. All thrown exceptions are intercepted and run through this. * Depending on their type they are wrapped or passed along. You can change this behavior if you need to. * <p>Note that all runtime exceptions, IOExceptions and ServletExceptions are not modified, * so if you over-ride this and throw one of those exceptions you will not get extra cruft. * <p>Also, a response is passed along. This may be used in over-rides, but is not used in the * basic implementation. If it is null, it should be ignored.</p> * * @param t * @param request * @param response * @throws IOException * @throws ServletException */ protected void handleException(Throwable t, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { error("INTERNAL ERROR: " + (t.getMessage() == null ? "(no message)" : t.getMessage())); // log it appropriately // ok, if it is a strange error, print a stack if you need to. if (isDebugOn()) { t.printStackTrace(); } t.printStackTrace(); getExceptionHandler().handleException(t, request, response); }