You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by yx...@apache.org on 2022/09/09 16:06:08 UTC

[shardingsphere] branch master updated: Add TrafficException (#20908)

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

yx9o pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 06307aa277a Add TrafficException (#20908)
06307aa277a is described below

commit 06307aa277a28c3dc01ae2b1877f3874593739cb
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Sep 10 00:05:59 2022 +0800

    Add TrafficException (#20908)
    
    * Add TrafficException
    
    * Update doc format
---
 .../content/user-manual/error-code/sql-error-code.cn.md  |  4 ++--
 .../content/user-manual/error-code/sql-error-code.en.md  |  4 ++--
 .../exception/EmptyTrafficExecutionUnitException.java    |  5 ++---
 ...ExecutionUnitException.java => TrafficException.java} | 16 +++++++++-------
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index 3025ddcfde1..33d5c3008ec 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -22,7 +22,7 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
 | HY000     | 10300       | Could not support variable \`%s\` |
 | HY004     | 10301       | Invalid value \`%s\` |
 | HV008     | 10302       | Column index \`%d\` is out of range |
-| 42S02     | 10303       | Can not find column label \`%s`\ |
+| 42S02     | 10303       | Can not find column label \`%s\` |
 | HY004     | 10400       | Invalid format for actual data node \`%s\` |
 | 08000     | 10500       | Connection has been closed |
 | 08000     | 10501       | Result set has been closed |
@@ -34,7 +34,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
 | 25000     | 11321       | JDBC does not support operations across multiple logical databases in transaction |
 | 25000     | 11322       | Failed to create \`%s\` XA data source |
 | 25000     | 11323       | Can not start new XA transaction in a active transaction |
-| 42S02     | 11400       | Can not get traffic execution unit |
 | 42000     | 12000       | Unsupported command: %s |
 | 44000     | 13000       | SQL check failed, error message: %s |
 | HY000     | 14000       | The table \`%s\` of schema \`%s\` is locked |
@@ -85,6 +84,7 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
 | 44000     | 23003       | Group name in MGR is not same with configured one \`%s\` in database \`%s\` |
 | 42000     | 24000       | Can not support database \`%s\` in SQL translation |
 | 42000     | 24001       | Translation error, SQL is: %s |
+| 42S02     | 25000       | Can not get traffic execution unit |
 | HY004     | 27000       | Encrypt algorithm \`%s\` initialize failed, reason is: %s |
 | 0A000     | 27001       | The SQL clause \`%s\` is unsupported in encrypt rule |
 | 44000     | 27002       | Altered column \`%s\` must use same encrypt algorithm with previous column \`%s\` in table \`%s\` |
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index 4dafe07cac7..c4c2cad3453 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -22,7 +22,7 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
 | HY000     | 10300       | Could not support variable \`%s\` |
 | HY004     | 10301       | Invalid value \`%s\` |
 | HV008     | 10302       | Column index \`%d\` is out of range |
-| 42S02     | 10303       | Can not find column label \`%s`\ |
+| 42S02     | 10303       | Can not find column label \`%s\` |
 | HY004     | 10400       | Invalid format for actual data node \`%s\` |
 | 08000     | 10500       | Connection has been closed |
 | 08000     | 10501       | Result set has been closed |
@@ -34,7 +34,6 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
 | 25000     | 11321       | JDBC does not support operations across multiple logical databases in transaction |
 | 25000     | 11322       | Failed to create \`%s\` XA data source |
 | 25000     | 11323       | Can not start new XA transaction in a active transaction |
-| 42S02     | 11400       | Can not get traffic execution unit |
 | 42000     | 12000       | Unsupported command: %s |
 | 44000     | 13000       | SQL check failed, error message: %s |
 | HY000     | 14000       | The table \`%s\` of schema \`%s\` is locked |
@@ -85,6 +84,7 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
 | 44000     | 23003       | Group name in MGR is not same with configured one \`%s\` in database \`%s\` |
 | 42000     | 24000       | Can not support database \`%s\` in SQL translation |
 | 42000     | 24001       | Translation error, SQL is: %s |
+| 42S02     | 25000       | Can not get traffic execution unit |
 | HY004     | 27000       | Encrypt algorithm \`%s\` initialize failed, reason is: %s |
 | 0A000     | 27001       | The SQL clause \`%s\` is unsupported in encrypt rule |
 | 44000     | 27002       | Altered column \`%s\` must use same encrypt algorithm with previous column \`%s\` in table \`%s\` |
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/EmptyTrafficExecutionUnitException.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/EmptyTrafficExecutionUnitException.java
index 73d3a19ef7e..40db50c2edc 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/EmptyTrafficExecutionUnitException.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/EmptyTrafficExecutionUnitException.java
@@ -17,17 +17,16 @@
 
 package org.apache.shardingsphere.traffic.exception;
 
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.kernel.KernelSQLException;
 import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
 
 /**
  * Empty traffic execution unit exception.
  */
-public final class EmptyTrafficExecutionUnitException extends KernelSQLException {
+public final class EmptyTrafficExecutionUnitException extends TrafficException {
     
     private static final long serialVersionUID = 1871625745475813160L;
     
     public EmptyTrafficExecutionUnitException() {
-        super(XOpenSQLState.NOT_FOUND, 1400, "Can not get traffic execution unit");
+        super(XOpenSQLState.NOT_FOUND, 0, "Can not get traffic execution unit");
     }
 }
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/EmptyTrafficExecutionUnitException.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/TrafficException.java
similarity index 67%
copy from shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/EmptyTrafficExecutionUnitException.java
copy to shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/TrafficException.java
index 73d3a19ef7e..ebb5f4cbbbe 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/EmptyTrafficExecutionUnitException.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-core/src/main/java/org/apache/shardingsphere/traffic/exception/TrafficException.java
@@ -17,17 +17,19 @@
 
 package org.apache.shardingsphere.traffic.exception;
 
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.kernel.KernelSQLException;
-import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.SQLState;
+import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
 
 /**
- * Empty traffic execution unit exception.
+ * Traffic exception.
  */
-public final class EmptyTrafficExecutionUnitException extends KernelSQLException {
+public abstract class TrafficException extends FeatureSQLException {
     
-    private static final long serialVersionUID = 1871625745475813160L;
+    private static final long serialVersionUID = -5882279624046667404L;
     
-    public EmptyTrafficExecutionUnitException() {
-        super(XOpenSQLState.NOT_FOUND, 1400, "Can not get traffic execution unit");
+    private static final int FEATURE_CODE = 5;
+    
+    public TrafficException(final SQLState sqlState, final int errorCode, final String reason, final Object... messageArguments) {
+        super(sqlState, FEATURE_CODE, errorCode, reason, messageArguments);
     }
 }