Browse Source

catch (Throwable t) 的 if 分支添加:&& txFun == null,在 TxFun 机制下始终向上抛出异常,因为
TxFun 中的 inv.invoke() 使得 getRender() 为非 null

James 3 years ago
parent
commit
50699e9d8e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/main/java/com/jfinal/plugin/activerecord/tx/Tx.java

+ 1 - 1
src/main/java/com/jfinal/plugin/activerecord/tx/Tx.java

@@ -109,7 +109,7 @@ public class Tx implements Interceptor {
 			if (conn != null) try {conn.rollback();} catch (Exception e1) {LogKit.error(e1.getMessage(), e1);}
 
 			// 支持在 controller 中 try catch 的 catch 块中使用 render(...) 并 throw e,实现灵活控制 render
-			if (inv.isActionInvocation() && inv.getController().getRender() != null) {
+			if (inv.isActionInvocation() && inv.getController().getRender() != null && txFun == null) {
 				LogKit.error(t.getMessage(), t);
 			} else {
 				throw t instanceof RuntimeException ? (RuntimeException)t : new ActiveRecordException(t);