NIHVIVO-3088 Display generic error page rather than white screen when there's a processing error in a freemarker controller.
This commit is contained in:
parent
c356b16807
commit
74357c15c6
1 changed files with 22 additions and 7 deletions
|
@ -78,9 +78,11 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
super.doGet(request,response);
|
super.doGet(request,response);
|
||||||
|
|
||||||
|
VitroRequest vreq = new VitroRequest(request);
|
||||||
|
ResponseValues responseValues = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
VitroRequest vreq = new VitroRequest(request);
|
|
||||||
|
|
||||||
Configuration config = getConfig(vreq);
|
Configuration config = getConfig(vreq);
|
||||||
vreq.setAttribute("freemarkerConfig", config);
|
vreq.setAttribute("freemarkerConfig", config);
|
||||||
|
|
||||||
|
@ -89,13 +91,26 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseValues responseValues = processRequest(vreq);
|
responseValues = processRequest(vreq);
|
||||||
doResponse(vreq, response, responseValues);
|
doResponse(vreq, response, responseValues);
|
||||||
|
|
||||||
} catch (TemplateProcessingException e) {
|
} catch (Throwable e) {
|
||||||
log.error(e.getMessage(), e);
|
if (e instanceof IOException || e instanceof ServletException) {
|
||||||
} catch (Throwable e) {
|
try {
|
||||||
log.error("FreeMarkerHttpServlet could not forward to view.", e);
|
throw e;
|
||||||
|
} catch (Throwable e1) {
|
||||||
|
handleException(vreq, response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleException(vreq, response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleException(VitroRequest vreq, HttpServletResponse response, Throwable t) throws ServletException {
|
||||||
|
try {
|
||||||
|
doResponse(vreq, response, new ExceptionResponseValues(t));
|
||||||
|
} catch (TemplateProcessingException e) {
|
||||||
|
throw new ServletException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue