This is an automated email from the ASF dual-hosted git repository.
panjuan 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 3451db87bd7 Adjust ResourceDefinitionException's SQL state (#30717)
3451db87bd7 is described below
commit 3451db87bd7cab4e2da3f313e5fe27bf3b41090c
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Mar 31 21:52:49 2024 +0800
Adjust ResourceDefinitionException's SQL state (#30717)
---
docs/document/content/user-manual/error-code/sql-error-code.cn.md | 6 +++---
docs/document/content/user-manual/error-code/sql-error-code.en.md | 6 +++---
.../storageunit/DuplicateStorageUnitExceptionDefinition.java | 2 +-
.../infra/exception/storageunit/StorageUnitsConnectException.java | 2 +-
.../infra/exception/storageunit/StorageUnitsOperateException.java | 2 +-
5 files changed, 9 insertions(+), 9 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 d84f6b4792d..0177ef65c86 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
@@ -26,12 +26,12 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| HY000 | 10022 | Can not load table with database name \`%s\` and
data source name \`%s\`. |
| 0A000 | 10030 | Can not drop schema \`%s\` because of contains
tables. |
| 0A000 | 10040 | Unsupported storage type of \`%s.%s\`.
|
-| 44000 | 10100 | Can not %s storage units '%s'.
|
+| HY000 | 10100 | Can not %s storage units '%s'.
|
| 42S02 | 10101 | There is no storage unit in database '%s'.
|
| 44000 | 10102 | Storage units '%s' do not exist in database '%s'.
|
| 44000 | 10103 | Storage unit '%s' still used by '%s'.
|
-| 44000 | 10104 | Duplicate storage unit names '%s'.
|
-| 0A000 | 10105 | Storage units can not connect, error messages are:
%s. |
+| 42S01 | 10104 | Duplicate storage unit names '%s'.
|
+| 08000 | 10105 | Storage units can not connect, error messages are:
%s. |
| 0A000 | 10106 | Can not alter connection info in storage units:
'%s'. |
| 44000 | 10120 | Invalid storage unit status, error message is: %s.
|
| 44000 | 10200 | Invalid '%s' rule '%s', error message is: %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 6a679000f96..1e59d9be03f 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
@@ -26,12 +26,12 @@ SQL error codes provide by standard `SQL State`, `Vendor
Code` and `Reason`, whi
| HY000 | 10022 | Can not load table with database name \`%s\` and
data source name \`%s\`. |
| 0A000 | 10030 | Can not drop schema \`%s\` because of contains
tables. |
| 0A000 | 10040 | Unsupported storage type of \`%s.%s\`.
|
-| 44000 | 10100 | Can not %s storage units '%s'.
|
+| HY000 | 10100 | Can not %s storage units '%s'.
|
| 42S02 | 10101 | There is no storage unit in database '%s'.
|
| 44000 | 10102 | Storage units '%s' do not exist in database '%s'.
|
| 44000 | 10103 | Storage unit '%s' still used by '%s'.
|
-| 44000 | 10104 | Duplicate storage unit names '%s'.
|
-| 0A000 | 10105 | Storage units can not connect, error messages are:
%s. |
+| 42S01 | 10104 | Duplicate storage unit names '%s'.
|
+| 08000 | 10105 | Storage units can not connect, error messages are:
%s. |
| 0A000 | 10106 | Can not alter connection info in storage units:
'%s'. |
| 44000 | 10120 | Invalid storage unit status, error message is: %s.
|
| 44000 | 10200 | Invalid '%s' rule '%s', error message is: %s
|
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/DuplicateStorageUnitExceptionDefinition.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/DuplicateStorageUnitExceptionDefinition.java
index f3491418e1a..39ba29e8342 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/DuplicateStorageUnitExceptionDefinition.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/DuplicateStorageUnitExceptionDefinition.java
@@ -30,6 +30,6 @@ public final class DuplicateStorageUnitExceptionDefinition
extends ResourceDefin
private static final long serialVersionUID = 2103793827572264148L;
public DuplicateStorageUnitExceptionDefinition(final Collection<String>
storageUnitNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 4, "Duplicate storage unit
names '%s'.", String.join(", ", storageUnitNames));
+ super(XOpenSQLState.DUPLICATE, 4, "Duplicate storage unit names
'%s'.", String.join(", ", storageUnitNames));
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsConnectException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsConnectException.java
index d7e3b620e09..b7507c1473b 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsConnectException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsConnectException.java
@@ -31,7 +31,7 @@ public final class StorageUnitsConnectException extends
ResourceDefinitionExcept
private static final long serialVersionUID = 1824912697040264268L;
public StorageUnitsConnectException(final Map<String, Exception> causes) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 5, "Storage units can not
connect, error messages are: %s.", causes.entrySet().stream().map(entry ->
String.format(
+ super(XOpenSQLState.CONNECTION_EXCEPTION, 5, "Storage units can not
connect, error messages are: %s.", causes.entrySet().stream().map(entry ->
String.format(
"Storage unit name: '%s', error message is: %s",
entry.getKey(),
entry.getValue().getMessage())).collect(Collectors.joining(System.lineSeparator())));
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsOperateException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsOperateException.java
index 7c5a726b658..de7550fcea9 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsOperateException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsOperateException.java
@@ -30,6 +30,6 @@ public final class StorageUnitsOperateException extends
ResourceDefinitionExcept
private static final long serialVersionUID = 7029641448948791509L;
public StorageUnitsOperateException(final String operationType, final
Collection<String> storageUnitNames, final Exception cause) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 0, String.format("Can not
%s storage units '%s'.", operationType, String.join(", ", storageUnitNames)),
cause);
+ super(XOpenSQLState.GENERAL_ERROR, 0, String.format("Can not %s
storage units '%s'.", operationType, String.join(", ", storageUnitNames)),
cause);
}
}