NIHVIVO-1461 Log specific error messages to distinguish template parse exception from template not found exception.

This commit is contained in:
ryounes 2011-04-05 17:46:21 +00:00
parent 2e200c6142
commit 6e9a877e07

View file

@ -89,7 +89,15 @@ public class TemplateProcessingHelper {
try {
template = config.getTemplate(templateName);
} catch (IOException e) {
throw new TemplateProcessingException("Cannot find template " + templateName);
String msg;
if (e instanceof freemarker.core.ParseException) {
msg = "Syntax error in template " + templateName;
} else if (e instanceof java.io.FileNotFoundException) {
msg = "Cannot find template " + templateName;
} else {
msg = "IOException getting template " + templateName;
}
throw new TemplateProcessingException(msg);
}
return template;
}