rythm.error.dev.errorPage.html Maven / Gradle / Ivy
@args String header
@extends(_base, header: header)
@returnIf(!isDev())
@render()
@ifNot(_error instanceof act.util.ActError) {
@section(head){
@render(moreStyles)
}
@if(_error.getLocalizedMessage()) {
stackTrace;
if (isCompileError) {stackTrace = null;}
else {stackTrace = actError.stackTrace();}
boolean activeSource = null == templateSourceInfo && null != sourceInfo;
boolean activeStack = null == templateSourceInfo && !activeSource && (null != stackTrace && !stackTrace.isEmpty());
}
@section(head){
@render(moreStyles)
}
@if(templateSourceInfo) {
@actMsg("error_page.template_code")
}
@if(sourceInfo) {
@actMsg("error_page.source_code")
}
@if(stackTrace) {
@actMsg("error_page.stacktrace")
}
@if(templateSourceInfo) {
@for(String line: templateSourceInfo.lines()) {
@{
String cls = line_index == templateSourceInfo.lineNumber() ? "error nohighlight" : ""
}
@line_index
@line.sp2nbsp()
}
}
@if(stackTrace) {
@{boolean traceErrorSet = false;}
@for(int i = 0; i < stackTrace.size(); ++i) {
@{
String trace = stackTrace.get(i);
String nextTrace = "";
if (i < stackTrace.size() - 1) {
nextTrace = stackTrace.get(i + 1);
}
String cls = "";
if (!traceErrorSet) {
if (null != sourceInfo && trace.contains(sourceInfo.fileName() + ":" + sourceInfo.lineNumber())) {
cls = "error";
traceErrorSet = true;
} else if (actError.isErrorSpot(trace, nextTrace)) {
cls = "error";
traceErrorSet = true;
}
}
if (trace.contains("Caused by")) {
cls = cls + " big-line";
}
}
@trace
}
}
@returnIf(null == sourceInfo && null == templateSourceInfo)
@if(sourceInfo) {
@for(String line: sourceInfo.lines()) {
@{
boolean isErrorLine = line_index == sourceInfo.lineNumber();
String cls = isErrorLine ? "error nohighlight" : ""
}
@line_index
@ifNot(isErrorLine || sourceInfo.column() < 0) {
@line.escapeHtml().sp2nbsp()
} else {
@line.escapeHtml().errorLine(sourceInfo.column())
}
}
}
}
@return
}
@{
act.util.ActError actError = (act.util.ActError)_error;
act.app.SourceInfo sourceInfo = actError.sourceInfo();
act.app.SourceInfo templateSourceInfo = null;
if (_error instanceof act.view.TemplateException) {
templateSourceInfo = ((act.view.TemplateException) actError).templateSourceInfo();
}
act.route.RouteInfo routeInfo = null != _action ? act.route.RouteInfo.of(_action) : null;
boolean isCompileError = actError.getCauseOrThis() instanceof act.app.CompilationException;
List