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

zhangliang 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 90504588a3d Refactor ShardingSphereSQLException's impl (#30770)
90504588a3d is described below

commit 90504588a3d8ebf1bd71a5bb13853eef4bc78053
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Apr 4 18:16:33 2024 +0800

    Refactor ShardingSphereSQLException's impl (#30770)
    
    * Refactor ShardingSphereSQLException
    
    * Refactor ShardingSphereSQLException
    
    * Refactor ShardingSphereSQLException
---
 .../core/external/sql/type/kernel/category/ClusterSQLException.java   | 4 ++++
 .../single/exception/metadata/SingleTablesLoadingException.java       | 2 +-
 .../timeservice/type/database/exception/DatetimeLoadingException.java | 2 +-
 .../cluster/exception/ClusterPersistRepositoryException.java          | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/ClusterSQLException.java
 
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/ClusterSQLException.java
index 8546f63f58e..83e82009061 100644
--- 
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/ClusterSQLException.java
+++ 
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/ClusterSQLException.java
@@ -32,4 +32,8 @@ public abstract class ClusterSQLException extends 
KernelSQLException {
     protected ClusterSQLException(final SQLState sqlState, final int 
errorCode, final String reason, final Object... messageArgs) {
         super(sqlState, KERNEL_CODE, errorCode, reason, messageArgs);
     }
+    
+    protected ClusterSQLException(final SQLState sqlState, final int 
errorCode, final String reason, final Exception cause) {
+        super(sqlState, KERNEL_CODE, errorCode, reason, cause);
+    }
 }
diff --git 
a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/metadata/SingleTablesLoadingException.java
 
b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/metadata/SingleTablesLoadingException.java
index 4bbbc2cb9a4..f1dd79735ab 100644
--- 
a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/metadata/SingleTablesLoadingException.java
+++ 
b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/metadata/SingleTablesLoadingException.java
@@ -29,6 +29,6 @@ public final class SingleTablesLoadingException extends 
SingleDefinitionExceptio
     private static final long serialVersionUID = 698261896187918188L;
     
     public SingleTablesLoadingException(final String databaseName, final 
String dataSourceName, final SQLException cause) {
-        super(XOpenSQLState.GENERAL_ERROR, 2, "Can not load table with 
database name '%s' and data source name '%s', reason is: %s", databaseName, 
dataSourceName, cause.getMessage());
+        super(XOpenSQLState.GENERAL_ERROR, 2, String.format("Can not load 
table with database name '%s' and data source name '%s'.", databaseName, 
dataSourceName), cause);
     }
 }
diff --git 
a/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/exception/DatetimeLoadingException.java
 
b/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/exception/DatetimeLoadingException.java
index c25ca973c5b..79de6008da3 100644
--- 
a/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/exception/DatetimeLoadingException.java
+++ 
b/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/exception/DatetimeLoadingException.java
@@ -30,6 +30,6 @@ public final class DatetimeLoadingException extends 
ConnectionSQLException {
     private static final long serialVersionUID = 7844267165522132993L;
     
     public DatetimeLoadingException(final SQLException cause) {
-        super(XOpenSQLState.GENERAL_ERROR, 40, "Load datetime from database 
failed, reason: %s", cause.getMessage());
+        super(XOpenSQLState.GENERAL_ERROR, 40, "Load datetime from database 
failed.", cause);
     }
 }
diff --git 
a/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/exception/ClusterPersistRepositoryException.java
 
b/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/exception/ClusterPersistRepositoryException.java
index 6a606d77405..eed877f86fc 100644
--- 
a/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/exception/ClusterPersistRepositoryException.java
+++ 
b/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/exception/ClusterPersistRepositoryException.java
@@ -28,6 +28,6 @@ public final class ClusterPersistRepositoryException extends 
ClusterSQLException
     private static final long serialVersionUID = -6417179023552012152L;
     
     public ClusterPersistRepositoryException(final Exception cause) {
-        super(XOpenSQLState.GENERAL_ERROR, 10, "Cluster persist repository 
error, reason is: %s", cause.getMessage());
+        super(XOpenSQLState.GENERAL_ERROR, 10, "Cluster persist repository 
error.", cause);
     }
 }

Reply via email to