if (cName.contains(TemplateClass.CN_SUFFIX)) {
// is it the embedded class?
if (cName.indexOf("$") != -1) {
cName = cName.substring(0, cName.lastIndexOf("$"));
}
TemplateClass tc = __engine.classes().getByClassName(cName);
if (null == tc) {
continue;
}
if (null == msg) {
msg = e.getMessage();
if (S.isEmpty(msg)) {
msg = "Rythm runtime exception caused by " + e.getClass().getName();
}
}
RythmException re = new RythmException(__engine, e, tc, se.getLineNumber(), -1, msg);
int lineNo = re.templateLineNumber;
String key = tc.getKey().toString();
int i = key.indexOf('\n');
if (i == -1) i = key.indexOf('\r');
if (i > -1) {
key = key.substring(0, i - 1) + "...";
}
if (key.length() > 80) key = key.substring(0, 80) + "...";
if (lineNo != -1) {
StackTraceElement[] newStack = new StackTraceElement[stackTrace.length + 1];
newStack[0] = new StackTraceElement(tc.name(), "", key, lineNo);
System.arraycopy(stackTrace, 0, newStack, 1, stackTrace.length);
re.setStackTrace(newStack);
}
throw re;
}