This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
     new 593fcf2de [linkis-cs-server]errorcode code optimization (#3520)
593fcf2de is described below

commit 593fcf2de0f51ec5a6db4ce13eceb531b267cb7e
Author: 成彬彬 <[email protected]>
AuthorDate: Fri Sep 23 18:39:55 2022 +0800

    [linkis-cs-server]errorcode code optimization (#3520)
---
 docs/errorcode/linkis-cs-server-errorcode.md       |  5 ++
 .../org/apache/linkis/cs/DefaultContextSearch.java |  5 +-
 .../errorcode/LinkisCsServerErrorCodeSummary.java  | 65 ++++++++++++++++++++++
 3 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/docs/errorcode/linkis-cs-server-errorcode.md 
b/docs/errorcode/linkis-cs-server-errorcode.md
new file mode 100644
index 000000000..d44b603ea
--- /dev/null
+++ b/docs/errorcode/linkis-cs-server-errorcode.md
@@ -0,0 +1,5 @@
+## linkis-cs-server errorcode
+
+| 模块名(服务名) | 错误码  | 描述 | Exception Class|
+| -------- | -------- | ----- |-----|
+|linkis-cs-server|1200001|Unknown Condition 
Type(未知条件类型)|LinkisCsServerErrorCodeSummary|
diff --git 
a/linkis-public-enhancements/linkis-context-service/linkis-cs-server/src/main/java/org/apache/linkis/cs/DefaultContextSearch.java
 
b/linkis-public-enhancements/linkis-context-service/linkis-cs-server/src/main/java/org/apache/linkis/cs/DefaultContextSearch.java
index abd95d3f7..1cda724df 100644
--- 
a/linkis-public-enhancements/linkis-context-service/linkis-cs-server/src/main/java/org/apache/linkis/cs/DefaultContextSearch.java
+++ 
b/linkis-public-enhancements/linkis-context-service/linkis-cs-server/src/main/java/org/apache/linkis/cs/DefaultContextSearch.java
@@ -34,6 +34,8 @@ import java.util.Map;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static 
org.apache.linkis.cs.errorcode.LinkisCsServerErrorCodeSummary.UNKNOWN_CONDITION_TYPE;
+
 public class DefaultContextSearch implements ContextSearch {
 
   private static Logger logger = 
LoggerFactory.getLogger(DefaultContextSearch.class);
@@ -84,6 +86,7 @@ public class DefaultContextSearch implements ContextSearch {
       return new ContextValueTypeConditionExecution(
           (ContextValueTypeCondition) condition, contextCacheService, 
contextID);
     }
-    throw new ContextSearchFailedException(1200001, "Unknown Condition Type");
+    throw new ContextSearchFailedException(
+        UNKNOWN_CONDITION_TYPE.getErrorCode(), 
UNKNOWN_CONDITION_TYPE.getErrorDesc());
   }
 }
diff --git 
a/linkis-public-enhancements/linkis-context-service/linkis-cs-server/src/main/java/org/apache/linkis/cs/errorcode/LinkisCsServerErrorCodeSummary.java
 
b/linkis-public-enhancements/linkis-context-service/linkis-cs-server/src/main/java/org/apache/linkis/cs/errorcode/LinkisCsServerErrorCodeSummary.java
new file mode 100644
index 000000000..1f7b5fee6
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-context-service/linkis-cs-server/src/main/java/org/apache/linkis/cs/errorcode/LinkisCsServerErrorCodeSummary.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.cs.errorcode;
+
+public enum LinkisCsServerErrorCodeSummary {
+  UNKNOWN_CONDITION_TYPE(
+      1200001, "Unknown Condition Type(未知条件类型)", "Unknown Condition 
Type(未知条件类型)");
+
+  /** (errorCode)错误码 */
+  private int errorCode;
+  /** (errorDesc)错误描述 */
+  private String errorDesc;
+  /** Possible reasons for the error(错误可能出现的原因) */
+  private String comment;
+
+  LinkisCsServerErrorCodeSummary(int errorCode, String errorDesc, String 
comment) {
+    this.errorCode = errorCode;
+    this.errorDesc = errorDesc;
+    this.comment = comment;
+  }
+
+  public int getErrorCode() {
+    return errorCode;
+  }
+
+  public void setErrorCode(int errorCode) {
+    this.errorCode = errorCode;
+  }
+
+  public String getErrorDesc() {
+    return errorDesc;
+  }
+
+  public void setErrorDesc(String errorDesc) {
+    this.errorDesc = errorDesc;
+  }
+
+  public String getComment() {
+    return comment;
+  }
+
+  public void setComment(String comment) {
+    this.comment = comment;
+  }
+
+  @Override
+  public String toString() {
+    return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to