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 3797b8cb8c1 Add DatetimeConfigurationFileNotFoundException (#20343)
3797b8cb8c1 is described below

commit 3797b8cb8c1b2e1eaf912132d89e690d6c594e77
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Aug 22 00:25:55 2022 +0800

    Add DatetimeConfigurationFileNotFoundException (#20343)
---
 .../content/user-manual/error-code/sql-error-code.cn.md      |  3 ++-
 .../content/user-manual/error-code/sql-error-code.en.md      |  3 ++-
 .../config/DatabaseDatetimeServiceConfiguration.java         |  4 ++--
 ....java => DatetimeConfigurationFileNotFoundException.java} | 12 +++++-------
 .../database/exception/DatetimeLoadingException.java         |  2 +-
 5 files changed, 12 insertions(+), 12 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 a1807652dd1..59cfa0fc3f0 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
@@ -18,7 +18,8 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
 | 44000     | 13000       | SQL check failed, error message: %s |
 | HY000     | 14000       | The table \`%s\` of schema \`%s\` is locked |
 | HY000     | 14001       | The table \`%s\` of schema \`%s\` lock wait 
timeout of %s ms exceeded |
-| HY000     | 14010       | Load datetime from database failed, reason: %s |
+| HY000     | 14010       | Can not find \`%s\` file for datetime initialize |
+| HY000     | 14011       | Load datetime from database failed, reason: %s |
 | HY000     | 15000       | Work ID assigned failed, which can not exceed 1024 
|
 | HY000     | 16000       | Can not find pipeline job \`%s\` |
 | HY000     | 16001       | Failed to get DDL for 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 832dd3f6e15..a5e0e008814 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
@@ -18,7 +18,8 @@ SQL error codes provide by standard `SQL State`, `Vendor 
Code` and `Reason`, whi
 | 44000     | 13000       | SQL check failed, error message: %s |
 | HY000     | 14000       | The table \`%s\` of schema \`%s\` is locked |
 | HY000     | 14001       | The table \`%s\` of schema \`%s\` lock wait 
timeout of %s ms exceeded |
-| HY000     | 14010       | Load datetime from database failed, reason: %s |
+| HY000     | 14010       | Can not find \`%s\` file for datetime initialize |
+| HY000     | 14011       | Load datetime from database failed, reason: %s |
 | HY000     | 15000       | Work ID assigned failed, which can not exceed 1024 
|
 | HY000     | 16000       | Can not find pipeline job \`%s\` |
 | HY000     | 16001       | Failed to get DDL for table \`%s\` |
diff --git 
a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfiguration.java
 
b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfiguration.java
index 5bacd970e3e..b136b582a79 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfiguration.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfiguration.java
@@ -18,10 +18,10 @@
 package org.apache.shardingsphere.datetime.database.config;
 
 import lombok.Getter;
+import 
org.apache.shardingsphere.datetime.database.exception.DatetimeConfigurationFileNotFoundException;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
 import 
org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 import 
org.apache.shardingsphere.infra.yaml.config.swapper.resource.YamlDataSourceConfigurationSwapper;
 import org.yaml.snakeyaml.Yaml;
 
@@ -55,7 +55,7 @@ public final class DatabaseDatetimeServiceConfiguration {
         try (InputStream inputStream = 
getClass().getClassLoader().getResourceAsStream(CONFIG_FILE)) {
             return new Yaml().loadAs(inputStream, Map.class);
         } catch (final IOException ex) {
-            throw new ShardingSphereException("Cannot load " + CONFIG_FILE + 
"file.", ex);
+            throw new DatetimeConfigurationFileNotFoundException(CONFIG_FILE);
         }
     }
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeLoadingException.java
 
b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeConfigurationFileNotFoundException.java
similarity index 71%
copy from 
shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeLoadingException.java
copy to 
shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeConfigurationFileNotFoundException.java
index 5286befcd78..aaec50c90d7 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeLoadingException.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeConfigurationFileNotFoundException.java
@@ -20,16 +20,14 @@ package 
org.apache.shardingsphere.datetime.database.exception;
 import 
org.apache.shardingsphere.infra.util.exception.sql.ShardingSphereSQLException;
 import 
org.apache.shardingsphere.infra.util.exception.sql.sqlstate.XOpenSQLState;
 
-import java.sql.SQLException;
-
 /**
- * Datetime loading exception.
+ * Datetime configuration file not found exception.
  */
-public final class DatetimeLoadingException extends ShardingSphereSQLException 
{
+public final class DatetimeConfigurationFileNotFoundException extends 
ShardingSphereSQLException {
     
-    private static final long serialVersionUID = 7844267165522132993L;
+    private static final long serialVersionUID = 4820838154441059833L;
     
-    public DatetimeLoadingException(final SQLException cause) {
-        super(XOpenSQLState.GENERAL_ERROR, 10000, "Load datetime from database 
failed, reason: %s", cause.getMessage());
+    public DatetimeConfigurationFileNotFoundException(final String 
configurationFile) {
+        super(XOpenSQLState.GENERAL_ERROR, 14010, "Can not find `%s` file for 
datetime initialize", configurationFile);
     }
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeLoadingException.java
 
b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeLoadingException.java
index 5286befcd78..0f7b70288fd 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeLoadingException.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/main/java/org/apache/shardingsphere/datetime/database/exception/DatetimeLoadingException.java
@@ -30,6 +30,6 @@ public final class DatetimeLoadingException extends 
ShardingSphereSQLException {
     private static final long serialVersionUID = 7844267165522132993L;
     
     public DatetimeLoadingException(final SQLException cause) {
-        super(XOpenSQLState.GENERAL_ERROR, 10000, "Load datetime from database 
failed, reason: %s", cause.getMessage());
+        super(XOpenSQLState.GENERAL_ERROR, 14011, "Load datetime from database 
failed, reason: %s", cause.getMessage());
     }
 }

Reply via email to