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

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


The following commit(s) were added to refs/heads/dev-1.3.1-errorcode by this 
push:
     new cc3eeb116 [linkis-engineconn-core]module errorcode optimization and 
documentation (#3543)
cc3eeb116 is described below

commit cc3eeb1166c33a6a1b18fe9f73d3bb54e76f2270
Author: 成彬彬 <[email protected]>
AuthorDate: Sun Oct 16 13:55:08 2022 +0800

    [linkis-engineconn-core]module errorcode optimization and documentation 
(#3543)
---
 docs/errorcode/linkis-engineconn-core-errorcode.md |  8 +++
 .../LinkisEngineconnCoreErrorCodeSummary.java      | 71 ++++++++++++++++++++++
 .../core/engineconn/EngineConnManager.scala        |  5 +-
 .../spark/cs/CSSparkPreExecutionHook.scala         |  5 +-
 4 files changed, 85 insertions(+), 4 deletions(-)

diff --git a/docs/errorcode/linkis-engineconn-core-errorcode.md 
b/docs/errorcode/linkis-engineconn-core-errorcode.md
new file mode 100644
index 000000000..26d3f30ec
--- /dev/null
+++ b/docs/errorcode/linkis-engineconn-core-errorcode.md
@@ -0,0 +1,8 @@
+## linkis-engineconn-core   errorcode
+
+| module name(模块名) | error code(错误码)  | describe(描述) |enumeration name(枚举)| 
Exception Class(类名)|
+| -------- | -------- | ----- |-----|-----|
+|linkis-engineconn-core  |12100|You need to wait for engine conn to be 
initialized before starting to call(在开始调用之前,您需要等待 engine conn 
初始化)|NEED_ENGINE_BEFORE_CALL|LinkisEngineconnCoreErrorCodeSummary|
+|linkis-engineconn-core  |12101| Cannot parse cs table for node(无法解析节点的 cs 
表):|CANNOT_PARSE_FOR_NODE|LinkisEngineconnCoreErrorCodeSummary|
+
+
diff --git 
a/linkis-computation-governance/linkis-engineconn/linkis-engineconn-core/src/main/java/org/apache/linkis/engineconn/core/errorcode/LinkisEngineconnCoreErrorCodeSummary.java
 
b/linkis-computation-governance/linkis-engineconn/linkis-engineconn-core/src/main/java/org/apache/linkis/engineconn/core/errorcode/LinkisEngineconnCoreErrorCodeSummary.java
new file mode 100644
index 000000000..d749d043c
--- /dev/null
+++ 
b/linkis-computation-governance/linkis-engineconn/linkis-engineconn-core/src/main/java/org/apache/linkis/engineconn/core/errorcode/LinkisEngineconnCoreErrorCodeSummary.java
@@ -0,0 +1,71 @@
+/*
+ * 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.engineconn.core.errorcode;
+
+public enum LinkisEngineconnCoreErrorCodeSummary {
+  NEED_ENGINE_BEFORE_CALL(
+      12100,
+      "You need to wait for engine conn to be initialized before starting to 
call(在开始调用之前,您需要等待 engine conn 初始化)",
+      "You need to wait for engine conn to be initialized before starting to 
call(在开始调用之前,您需要等待 engine conn 初始化)"),
+  CANNOT_PARSE_FOR_NODE(
+      12101,
+      "Cannot parse cs table for node(无法解析节点的 cs 表):",
+      "Cannot parse cs table for node(无法解析节点的 cs 表):");
+
+  /** (errorCode)错误码 */
+  private int errorCode;
+  /** (errorDesc)错误描述 */
+  private String errorDesc;
+  /** Possible reasons for the error(错误可能出现的原因) */
+  private String comment;
+
+  LinkisEngineconnCoreErrorCodeSummary(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;
+  }
+}
diff --git 
a/linkis-computation-governance/linkis-engineconn/linkis-engineconn-core/src/main/scala/org/apache/linkis/engineconn/core/engineconn/EngineConnManager.scala
 
b/linkis-computation-governance/linkis-engineconn/linkis-engineconn-core/src/main/scala/org/apache/linkis/engineconn/core/engineconn/EngineConnManager.scala
index 1237e5179..e0ae2e25b 100644
--- 
a/linkis-computation-governance/linkis-engineconn/linkis-engineconn-core/src/main/scala/org/apache/linkis/engineconn/core/engineconn/EngineConnManager.scala
+++ 
b/linkis-computation-governance/linkis-engineconn/linkis-engineconn-core/src/main/scala/org/apache/linkis/engineconn/core/engineconn/EngineConnManager.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.engineconn.core.engineconn
 import org.apache.linkis.engineconn.common.creation.EngineCreationContext
 import org.apache.linkis.engineconn.common.engineconn.EngineConn
 import org.apache.linkis.engineconn.core.EngineConnObject
+import 
org.apache.linkis.engineconn.core.errorcode.LinkisEngineconnCoreErrorCodeSummary.NEED_ENGINE_BEFORE_CALL
 import org.apache.linkis.engineconn.core.exception.{EngineConnErrorCode, 
EngineConnFatalException}
 
 trait EngineConnManager {
@@ -51,8 +52,8 @@ class DefaultEngineConnManager extends EngineConnManager {
   override def getEngineConn: EngineConn = {
     if (null == this.engineConn) {
       throw new EngineConnFatalException(
-        EngineConnErrorCode.ENGINE_CONN_UN_INIT_CODE,
-        "You need to wait for engine conn to be initialized before starting to 
call"
+        NEED_ENGINE_BEFORE_CALL.getErrorCode,
+        NEED_ENGINE_BEFORE_CALL.getErrorDesc
       )
     }
     this.engineConn
diff --git 
a/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/cs/CSSparkPreExecutionHook.scala
 
b/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/cs/CSSparkPreExecutionHook.scala
index 1d7d6ee4e..92c0fdc22 100644
--- 
a/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/cs/CSSparkPreExecutionHook.scala
+++ 
b/linkis-engineconn-plugins/spark/src/main/scala/org/apache/linkis/engineplugin/spark/cs/CSSparkPreExecutionHook.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.engineplugin.spark.cs
 import org.apache.linkis.common.utils.{Logging, Utils}
 import org.apache.linkis.cs.client.utils.ContextServiceUtils
 import 
org.apache.linkis.engineconn.computation.executor.execute.EngineExecutionContext
+import 
org.apache.linkis.engineconn.core.errorcode.LinkisEngineconnCoreErrorCodeSummary.CANNOT_PARSE_FOR_NODE
 import org.apache.linkis.engineconn.core.exception.{EngineConnErrorCode, 
ExecutorHookFatalException}
 import org.apache.linkis.engineplugin.spark.extension.SparkPreExecutionHook
 
@@ -60,8 +61,8 @@ class CSSparkPreExecutionHook extends SparkPreExecutionHook 
with Logging {
       }
       logger.info("Failed to parser cs table because : ", msg)
       throw new ExecutorHookFatalException(
-        EngineConnErrorCode.ENGINE_CONN_EXECUTOR_INIT_ERROR,
-        s"Cannot parse cs table for node : ${nodeNameStr}."
+        CANNOT_PARSE_FOR_NODE.getErrorCode,
+        CANNOT_PARSE_FOR_NODE.getErrorDesc + s"${nodeNameStr}."
       )
     }
     logger.info(


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

Reply via email to