You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/10/16 06:15:24 UTC

[incubator-linkis] branch dev-1.3.1-errorcode updated: [shell]errorcode code optimization (#3526)

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 93f7d0ff3 [shell]errorcode code optimization (#3526)
93f7d0ff3 is described below

commit 93f7d0ff3f8943dda3fcc967059e354fea0a6697
Author: 成彬彬 <10...@users.noreply.github.com>
AuthorDate: Sun Oct 16 14:15:18 2022 +0800

    [shell]errorcode code optimization (#3526)
---
 docs/errorcode/shell-errorcode.md                  |  6 ++
 .../errorcode/LinkisCommonsErrorCodeSummary.java   | 68 ++++++++++++++++++++++
 .../shell/exception/NoCorrectUserException.scala   |  6 +-
 3 files changed, 78 insertions(+), 2 deletions(-)

diff --git a/docs/errorcode/shell-errorcode.md b/docs/errorcode/shell-errorcode.md
new file mode 100644
index 000000000..5c2584f3a
--- /dev/null
+++ b/docs/errorcode/shell-errorcode.md
@@ -0,0 +1,6 @@
+## shell errorcode
+
+| 模块名(服务名) | 错误码  | 描述 | Exception Class|
+| -------- | -------- | ----- |-----|
+|shell|50036|No illegal user holds this process(没有非法用户持有这个进程)|LinkisCommonsErrorCodeSummary|
+|shell|50037|shell code is wrong(shell代码错误)|LinkisCommonsErrorCodeSummary|
diff --git a/linkis-engineconn-plugins/shell/src/main/java/org/apache/linkis/manager/engineplugin/shell/errorcode/LinkisCommonsErrorCodeSummary.java b/linkis-engineconn-plugins/shell/src/main/java/org/apache/linkis/manager/engineplugin/shell/errorcode/LinkisCommonsErrorCodeSummary.java
new file mode 100644
index 000000000..2f72f8719
--- /dev/null
+++ b/linkis-engineconn-plugins/shell/src/main/java/org/apache/linkis/manager/engineplugin/shell/errorcode/LinkisCommonsErrorCodeSummary.java
@@ -0,0 +1,68 @@
+/*
+ * 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.manager.engineplugin.shell.errorcode;
+
+public enum LinkisCommonsErrorCodeSummary {
+  NO_ILLEGAL_USER_HOLDS(
+      50036,
+      "No illegal user holds this process(没有非法用户持有这个进程)",
+      "No illegal user holds this process(没有非法用户持有这个进程)"),
+  SHELL_CODE_IS_WRONG(50037, "shell code is wrong(shell代码错误)", "shell code is wrong(shell代码错误)");
+
+  /** 错误码 */
+  private int errorCode;
+  /** 错误描述 */
+  private String errorDesc;
+  /** 错误可能出现的原因 */
+  private String comment;
+
+  LinkisCommonsErrorCodeSummary(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-engineconn-plugins/shell/src/main/scala/org/apache/linkis/manager/engineplugin/shell/exception/NoCorrectUserException.scala b/linkis-engineconn-plugins/shell/src/main/scala/org/apache/linkis/manager/engineplugin/shell/exception/NoCorrectUserException.scala
index 565870fb3..e91c5923c 100644
--- a/linkis-engineconn-plugins/shell/src/main/scala/org/apache/linkis/manager/engineplugin/shell/exception/NoCorrectUserException.scala
+++ b/linkis-engineconn-plugins/shell/src/main/scala/org/apache/linkis/manager/engineplugin/shell/exception/NoCorrectUserException.scala
@@ -18,8 +18,10 @@
 package org.apache.linkis.manager.engineplugin.shell.exception
 
 import org.apache.linkis.common.exception.ErrorException
+import org.apache.linkis.manager.engineplugin.shell.errorcode.LinkisCommonsErrorCodeSummary._
 
 case class NoCorrectUserException()
-    extends ErrorException(50036, "No illegal user holds this process")
+    extends ErrorException(NO_ILLEGAL_USER_HOLDS.getErrorCode, NO_ILLEGAL_USER_HOLDS.getErrorDesc)
 
-case class ShellCodeErrorException() extends ErrorException(50037, "shell code is wrong")
+case class ShellCodeErrorException()
+    extends ErrorException(SHELL_CODE_IS_WRONG.getErrorCode, SHELL_CODE_IS_WRONG.getErrorDesc)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org