Skip to content

Commit

Permalink
v3.14.4 release (^.^)YYa!!
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfuhai committed Apr 7, 2022
1 parent e777a57 commit ec782ee
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
jboot v3.14.4:
新增:生产环境忽略模板指令渲染错误的功能,保证其他内容正常渲染
新增:模板错误渲染器 TemplateErrorRender,用于追加模板指令错误内容
新增:是否开启 Controller Action 缓存的开关,方便在不同的场景下进行开启或者关闭
新增:JbootEventManager 可以设置自己的线程池
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
package io.jboot.web.directive.base;

import com.jfinal.aop.Aop;
import com.jfinal.log.Log;
import com.jfinal.template.Directive;
import com.jfinal.template.Env;
import com.jfinal.template.TemplateException;
import com.jfinal.template.expr.ast.ExprList;
import com.jfinal.template.io.Writer;
import com.jfinal.template.stat.Scope;
import io.jboot.Jboot;
import io.jboot.utils.StrUtil;

import java.io.IOException;
Expand All @@ -34,6 +36,17 @@
*/
public abstract class JbootDirectiveBase extends Directive {

private static final Log LOG = Log.getLog(JbootDirectiveBase.class);

private static boolean devMode = Jboot.isDevMode();

public static boolean isDevMode() {
return devMode;
}

public static void setDevMode(boolean devMode) {
JbootDirectiveBase.devMode = devMode;
}

public JbootDirectiveBase() {
Aop.inject(this);
Expand All @@ -51,7 +64,19 @@ public void exec(Env env, Scope scope, Writer writer) {
scope = new Scope(scope);
scope.getCtrl().setLocalAssignment();
exprList.eval(scope);
onRender(env, scope, writer);

try {
onRender(env, scope, writer);
} catch (Throwable e) {
if (devMode) {
throw e;
}
// 生产环境下,忽略指令错误渲染
else {
LOG.error("Template Directive render error!!!", e);
}
}

}


Expand Down

0 comments on commit ec782ee

Please sign in to comment.