You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/08/15 14:44:41 UTC

[shardingsphere] branch master updated: Refactor SQLCheckException (#20203)

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

jianglongtao 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 7e5ac59d7bf Refactor SQLCheckException (#20203)
7e5ac59d7bf is described below

commit 7e5ac59d7bf169bfc3cbcf11ec2838a18bae8dac
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Aug 15 22:44:31 2022 +0800

    Refactor SQLCheckException (#20203)
    
    * Rename UnsupportedShadowColumnTypeException
    
    * Refactor SQLCheckException
---
 .../org/apache/shardingsphere/infra/check/SQLCheckException.java   | 7 ++++---
 .../infra/util/exception/sql/sqlstate/XOpenSQLState.java           | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/check/SQLCheckException.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/check/SQLCheckException.java
index e120f24c815..dc5104f6a9c 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/check/SQLCheckException.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/check/SQLCheckException.java
@@ -17,16 +17,17 @@
 
 package org.apache.shardingsphere.infra.check;
 
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.util.exception.sql.ShardingSphereSQLException;
+import org.apache.shardingsphere.infra.util.exception.sql.sqlstate.XOpenSQLState;
 
 /**
  * SQL check exception.
  */
-public final class SQLCheckException extends ShardingSphereException {
+public final class SQLCheckException extends ShardingSphereSQLException {
     
     private static final long serialVersionUID = 4183020614721058122L;
     
     public SQLCheckException(final String errorMessage) {
-        super("SQL checking failed. Error message: %s.", errorMessage);
+        super(XOpenSQLState.CHECK_OPTION_VIOLATION, 1301, "SQL check failed, error message: %s", errorMessage);
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/sqlstate/XOpenSQLState.java b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/sqlstate/XOpenSQLState.java
index d87e9fdf006..514d4c1e13e 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/sqlstate/XOpenSQLState.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/sqlstate/XOpenSQLState.java
@@ -49,6 +49,8 @@ public enum XOpenSQLState implements SQLState {
     
     NOT_FOUND("42S02"),
     
+    CHECK_OPTION_VIOLATION("44000"),
+    
     GENERAL_ERROR("HY000"),
     
     INVALID_DATA_TYPE("HY004");