Pārlūkot izejas kodu

enhancement #I5IOC5 LiteFlowResponse增加一个errorCode

everywhere.z 2 gadi atpakaļ
vecāks
revīzija
fee14a6a22
29 mainītis faili ar 44 papildinājumiem un 57 dzēšanām
  1. 1 2
      liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java
  2. 5 16
      liteflow-core/src/main/java/com/yomahub/liteflow/exception/LiteFlowException.java
  3. 4 6
      liteflow-core/src/main/java/com/yomahub/liteflow/flow/LiteflowResponse.java
  4. 1 1
      liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java
  5. 1 1
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  6. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2ELDeclSpringBootTest.java
  7. 1 1
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java
  8. 1 1
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  9. 2 2
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception2Test.java
  10. 1 1
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java
  11. 1 1
      liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  12. 2 2
      liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2ELSpringBootTest.java
  13. 1 1
      liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java
  14. 1 0
      liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java
  15. 1 1
      liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  16. 2 2
      liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception2ELSpringTest.java
  17. 1 1
      liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java
  18. 1 1
      liteflow-testcase-old/liteflow-testcase-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  19. 2 2
      liteflow-testcase-old/liteflow-testcase-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2SpringBootTest.java
  20. 1 1
      liteflow-testcase-old/liteflow-testcase-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java
  21. 1 1
      liteflow-testcase-old/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  22. 2 2
      liteflow-testcase-old/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception2Test.java
  23. 1 1
      liteflow-testcase-old/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java
  24. 1 1
      liteflow-testcase-old/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  25. 2 2
      liteflow-testcase-old/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2SpringBootTest.java
  26. 1 1
      liteflow-testcase-old/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java
  27. 1 1
      liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java
  28. 2 2
      liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception2SpringTest.java
  29. 1 1
      liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

+ 1 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java

@@ -209,8 +209,7 @@ public class FlowExecutor {
     private LiteflowResponse execute2Resp(String chainId, Object param, Class<?>[] contextBeanClazzArray,
                                           Integer slotIndex, boolean isInnerChain) {
         Slot slot = doExecute(chainId, param, contextBeanClazzArray, slotIndex, isInnerChain);
-        LiteflowResponse response = new LiteflowResponse(slot);
-        return response;
+        return new LiteflowResponse(slot);
     }
 
     private Slot doExecute(String chainId, Object param, Class<?>[] contextBeanClazzArray, Integer slotIndex,

+ 5 - 16
liteflow-core/src/main/java/com/yomahub/liteflow/exception/LiteFlowException.java

@@ -4,16 +4,15 @@ package com.yomahub.liteflow.exception;
 /**
  * LiteFlow架内部逻辑发生错误抛出的异常
  * (自定义此异常方便开发者在做全局异常处理时分辨异常类型)
- *
  * @author zendwang
- *
+ * @since 2.8.3
  */
 public class LiteFlowException extends RuntimeException {
 
 	private static final long serialVersionUID = 1L;
 
 	/** 异常状态码 */
-	private int code;
+	private String code;
 
 	/**
 	 * 构建一个异常
@@ -29,7 +28,7 @@ public class LiteFlowException extends RuntimeException {
 	 * @param code 异常状态码
 	 * @param message 异常描述信息
 	 */
-	public LiteFlowException(int code, String message) {
+	public LiteFlowException(String code, String message) {
 		super(message);
 		this.code = code;
 	}
@@ -43,16 +42,6 @@ public class LiteFlowException extends RuntimeException {
 		super(cause);
 	}
 
-	/**
-	 * 构建一个异常
-	 * @param code 异常状态码
-	 * @param cause 异常对象
-	 */
-	public LiteFlowException(int code, Throwable cause) {
-		super(cause);
-		this.code = code;
-	}
-
 	/**
 	 * 构建一个异常
 	 *
@@ -69,7 +58,7 @@ public class LiteFlowException extends RuntimeException {
 	 * @param message 异常信息
 	 * @param cause 异常对象
 	 */
-	public LiteFlowException(int code, String message, Throwable cause) {
+	public LiteFlowException(String code, String message, Throwable cause) {
 		super(message, cause);
 		this.code = code;
 	}
@@ -77,7 +66,7 @@ public class LiteFlowException extends RuntimeException {
 	/**
 	 * @return 获得异常状态码
 	 */
-	public int getCode() {
+	public String getCode() {
 		return code;
 	}
 }

+ 4 - 6
liteflow-core/src/main/java/com/yomahub/liteflow/flow/LiteflowResponse.java

@@ -19,7 +19,7 @@ public class LiteflowResponse implements Serializable {
     
     private boolean success;
 
-    private int code;
+    private String code;
 
     private String message;
     
@@ -35,11 +35,9 @@ public class LiteflowResponse implements Serializable {
             this.success = false;
             this.cause = slot.getException();
             this.message = this.cause.getMessage();
-            this.code = this.cause instanceof LiteFlowException ? ((LiteFlowException)this.cause).getCode() : -1;
+            this.code = this.cause instanceof LiteFlowException ? ((LiteFlowException)this.cause).getCode() : null;
         } else {
             this.success = true;
-            this.code = 0;
-            this.message = "";
         }
         this.slot = slot;
     }
@@ -60,11 +58,11 @@ public class LiteflowResponse implements Serializable {
         this.message = message;
     }
 
-    public int getCode() {
+    public String getCode() {
         return code;
     }
 
-    public void setCode(int code) {
+    public void setCode(String code) {
         this.code = code;
     }
 

+ 1 - 1
liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java

@@ -122,7 +122,7 @@ public class Slot{
 		}
 	}
 
-	public <T> void setChainReqData(String chainId, T t) {
+	public synchronized <T> void setChainReqData(String chainId, T t) {
 		String key = CHAIN_REQ_PREFIX + chainId;
 		if (hasMetaData(key)){
 			Queue<Object> queue = (Queue<Object>) metaDataMap.get(key);

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2ELDeclSpringBootTest.java

@@ -61,7 +61,7 @@ public class Exception2ELDeclSpringBootTest extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -71,6 +71,6 @@ public class Exception2ELDeclSpringBootTest extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -27,7 +27,7 @@ public class FCmp {
 	public void process(NodeComponent bindCmp) {
 		String str = bindCmp.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception2Test.java

@@ -69,7 +69,7 @@ public class Exception2Test extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -79,6 +79,6 @@ public class Exception2Test extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -21,7 +21,7 @@ public class FCmp extends NodeComponent {
 	public void process() {
 		String str = this.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2ELSpringBootTest.java

@@ -69,7 +69,7 @@ public class Exception2ELSpringBootTest extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -79,6 +79,6 @@ public class Exception2ELSpringBootTest extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -23,7 +23,7 @@ public class FCmp extends NodeComponent {
 	public void process() {
 		String str = this.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}

+ 1 - 0
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java

@@ -10,6 +10,7 @@ import org.junit.runner.RunWith;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.annotation.Repeat;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringRunner;
 

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception2ELSpringTest.java

@@ -56,7 +56,7 @@ public class Exception2ELSpringTest extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -66,6 +66,6 @@ public class Exception2ELSpringTest extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -23,7 +23,7 @@ public class FCmp extends NodeComponent {
 	public void process() {
 		String str = this.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-old/liteflow-testcase-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2SpringBootTest.java

@@ -73,7 +73,7 @@ public class Exception2SpringBootTest extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -83,6 +83,6 @@ public class Exception2SpringBootTest extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-declare-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -27,7 +27,7 @@ public class FCmp {
 	public void process(NodeComponent bindCmp) {
 		String str = bindCmp.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-old/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception2Test.java

@@ -66,7 +66,7 @@ public class Exception2Test extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -76,6 +76,6 @@ public class Exception2Test extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -21,7 +21,7 @@ public class FCmp extends NodeComponent {
 	public void process() {
 		String str = this.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-old/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception2SpringBootTest.java

@@ -76,7 +76,7 @@ public class Exception2SpringBootTest extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -86,6 +86,6 @@ public class Exception2SpringBootTest extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -23,7 +23,7 @@ public class FCmp extends NodeComponent {
 	public void process() {
 		String str = this.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/CustomStatefulException.java

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.exception.LiteFlowException;
  * 用户自定义带状态码的异常
  */
 public class CustomStatefulException extends LiteFlowException {
-	public CustomStatefulException(int code, String message) {
+	public CustomStatefulException(String code, String message) {
 		super(code, message);
 	}
 }

+ 2 - 2
liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception2SpringTest.java

@@ -67,7 +67,7 @@ public class Exception2SpringTest extends BaseTest {
     public void testInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "custom-stateful-exception");
         Assert.assertFalse(response.isSuccess());
-        Assert.assertEquals(300, response.getCode());
+        Assert.assertEquals("300", response.getCode());
         Assert.assertNotNull(response.getCause());
         Assert.assertTrue(response.getCause() instanceof LiteFlowException);
         Assert.assertNotNull(response.getSlot());
@@ -77,6 +77,6 @@ public class Exception2SpringTest extends BaseTest {
     public void testNotInvokeCustomStatefulException() {
         LiteflowResponse response = flowExecutor.execute2Resp("chain6", "test");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(0, response.getCode());
+        Assert.assertNull(response.getCode());
     }
 }

+ 1 - 1
liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/cmp/FCmp.java

@@ -23,7 +23,7 @@ public class FCmp extends NodeComponent {
 	public void process() {
 		String str = this.getRequestData();
 		if(StrUtil.isNotBlank(str) && str.equals("custom-stateful-exception")) {
-			throw new CustomStatefulException(300, "chain execute custom stateful execption");
+			throw new CustomStatefulException("300", "chain execute custom stateful execption");
 		}
 		LOG.info("Fcomp executed!");
 	}