This is an automated email from the ASF dual-hosted git repository.
totalo 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 c8f881cd536 Revise error code and add document (#20280)
c8f881cd536 is described below
commit c8f881cd53690038ca58a75fb75ab65be169f388
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 18 23:05:08 2022 +0800
Revise error code and add document (#20280)
---
.../content/user-manual/error-code/_index.cn.md | 24 ++++++++++++++++++++++
.../content/user-manual/error-code/_index.en.md | 24 ++++++++++++++++++++++
.../UnsupportedShadowColumnTypeException.java | 2 +-
.../infra/check/SQLCheckException.java | 2 +-
.../ShardingSphereConfigurationException.java | 2 +-
.../metadata/UnrecognizedDatabaseURLException.java | 2 +-
.../exception/TableLockWaitTimeoutException.java | 2 +-
.../infra/lock/exception/TableLockedException.java | 2 +-
.../dialect/SQLServerSchemaMetaDataLoader.java | 4 ++--
.../dialect/SQLServerSchemaMetaDataLoaderTest.java | 14 ++++++-------
.../util/exception/sql/UnknownSQLException.java | 2 +-
.../exception/PipelineJobNotFoundException.java | 2 +-
.../exception/ResourceNotExistedException.java | 2 +-
.../backend/exception/RuleNotExistedException.java | 2 +-
.../frontend/exception/CircuitBreakException.java | 2 +-
.../exception/UnsupportedCommandException.java | 2 +-
.../mysql/err/MySQLErrPacketFactoryTest.java | 14 ++++++-------
.../sql/parser/exception/SQLParsingException.java | 6 +++---
18 files changed, 79 insertions(+), 31 deletions(-)
diff --git a/docs/document/content/user-manual/error-code/_index.cn.md
b/docs/document/content/user-manual/error-code/_index.cn.md
new file mode 100644
index 00000000000..ea474517cfb
--- /dev/null
+++ b/docs/document/content/user-manual/error-code/_index.cn.md
@@ -0,0 +1,24 @@
++++
+pre = "<b>4.4. </b>"
+title = "错误码"
+weight = 4
+chapter = true
++++
+
+本章列举所有的 Apache ShardingSphere 错误码,错误码以标准的 SQL State,Vendor Code 和详细错误信息提供。
+
+| SQL State | Vendor Code | 错误信息 |
+| --------- | ----------- | ------ |
+| 01000 | 10000 | Circuit break open, the request has been ignored |
+| 08000 | 10001 | The URL `%s` is not recognized, please refer to
the pattern `%s` |
+| 42000 | 11000 | You have an error in your SQL syntax |
+| 42000 | 11001 | configuration error |
+| 42000 | 11002 | Resource does not exist |
+| 42000 | 11003 | Rule does not exist |
+| 42000 | 12000 | Unsupported command: %s |
+| 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 | 15000 | Can not find pipeline job `%s` |
+| HY004 | 25000 | Shadow column `%s` of table `%s` does not support
`%s` type |
+| 42000 | 30000 | Unknown exception: %s |
\ No newline at end of file
diff --git a/docs/document/content/user-manual/error-code/_index.en.md
b/docs/document/content/user-manual/error-code/_index.en.md
new file mode 100644
index 00000000000..6f5a756ccd8
--- /dev/null
+++ b/docs/document/content/user-manual/error-code/_index.en.md
@@ -0,0 +1,24 @@
++++
+pre = "<b>4.4. </b>"
+title = "Error Code"
+weight = 4
+chapter = true
++++
+
+This chapter lists all error codes of Apache ShardingSphere, it provides by
standard `SQL State`, `Vendor Code` and `Reason`.
+
+| SQL State | Vendor Code | Reason |
+| --------- | ----------- | ------ |
+| 01000 | 10000 | Circuit break open, the request has been ignored |
+| 08000 | 10001 | The URL `%s` is not recognized, please refer to
the pattern `%s` |
+| 42000 | 11000 | You have an error in your SQL syntax |
+| 42000 | 11001 | configuration error |
+| 42000 | 11002 | Resource does not exist |
+| 42000 | 11003 | Rule does not exist |
+| 42000 | 12000 | Unsupported command: %s |
+| 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 | 15000 | Can not find pipeline job `%s` |
+| HY004 | 25000 | Shadow column `%s` of table `%s` does not support
`%s` type |
+| 42000 | 30000 | Unknown exception: %s |
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/UnsupportedShadowColumnTypeException.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/UnsupportedShadowColumnTypeException.java
index d115ad70c30..f85aa980139 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/UnsupportedShadowColumnTypeException.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/UnsupportedShadowColumnTypeException.java
@@ -28,6 +28,6 @@ public final class UnsupportedShadowColumnTypeException
extends ShardingSphereSQ
private static final long serialVersionUID = 8144277065388645946L;
public UnsupportedShadowColumnTypeException(final String tableName, final
String columnName, final Class<?> type) {
- super(XOpenSQLState.INVALID_DATA_TYPE, 1501, "Shadow column `%s` of
table `%s` does not support `%s` type", columnName, tableName, type.getName());
+ super(XOpenSQLState.INVALID_DATA_TYPE, 25000, "Shadow column `%s` of
table `%s` does not support `%s` type", columnName, tableName, type.getName());
}
}
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 dc5104f6a9c..5a098e2e9c7 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
@@ -28,6 +28,6 @@ public final class SQLCheckException extends
ShardingSphereSQLException {
private static final long serialVersionUID = 4183020614721058122L;
public SQLCheckException(final String errorMessage) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 1301, "SQL check failed,
error message: %s", errorMessage);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 13000, "SQL check failed,
error message: %s", errorMessage);
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
index c6a7215d955..f9093b5793c 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
@@ -28,6 +28,6 @@ public final class ShardingSphereConfigurationException
extends ShardingSphereSQ
private static final long serialVersionUID = -1360264079938958332L;
public ShardingSphereConfigurationException(final String reason, final
String... messageArguments) {
- super(XOpenSQLState.SYNTAX_ERROR, 1235, reason, messageArguments);
+ super(XOpenSQLState.SYNTAX_ERROR, 11001, reason, messageArguments);
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/UnrecognizedDatabaseURLException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/UnrecognizedDatabaseURLException.java
index 565b594eb48..d7fcc53dd5e 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/UnrecognizedDatabaseURLException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/UnrecognizedDatabaseURLException.java
@@ -28,6 +28,6 @@ public final class UnrecognizedDatabaseURLException extends
ShardingSphereSQLExc
private static final long serialVersionUID = -1551117178863766353L;
public UnrecognizedDatabaseURLException(final String url, final String
pattern) {
- super(XOpenSQLState.CONNECTION_EXCEPTION, 1940, "The URL `%s` is not
recognized, please refer to the pattern `%s`.", url, pattern);
+ super(XOpenSQLState.CONNECTION_EXCEPTION, 10001, "The URL `%s` is not
recognized, please refer to the pattern `%s`", url, pattern);
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockWaitTimeoutException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockWaitTimeoutException.java
index 397e4fec1a0..5f7ce69a4c3 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockWaitTimeoutException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockWaitTimeoutException.java
@@ -28,6 +28,6 @@ public final class TableLockWaitTimeoutException extends
ShardingSphereSQLExcept
private static final long serialVersionUID = 2599713085782288003L;
public TableLockWaitTimeoutException(final String schemaName, final String
tableName, final long timeoutMilliseconds) {
- super(XOpenSQLState.GENERAL_ERROR, 1301, "The table `%s` of schema
`%s` lock wait timeout of %s ms exceeded", tableName, schemaName,
String.valueOf(timeoutMilliseconds));
+ super(XOpenSQLState.GENERAL_ERROR, 14001, "The table `%s` of schema
`%s` lock wait timeout of %s ms exceeded", tableName, schemaName,
String.valueOf(timeoutMilliseconds));
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockedException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockedException.java
index c0a17959328..c71c7e1c767 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockedException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/exception/TableLockedException.java
@@ -28,6 +28,6 @@ public final class TableLockedException extends
ShardingSphereSQLException {
private static final long serialVersionUID = 2622020743612706932L;
public TableLockedException(final String schemaName, final String
tableName) {
- super(XOpenSQLState.GENERAL_ERROR, 1302, "The table `%s` of schema
`%s` is locked", tableName, schemaName);
+ super(XOpenSQLState.GENERAL_ERROR, 14000, "The table `%s` of schema
`%s` is locked", tableName, schemaName);
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoader.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoader.java
index bfe8db45afc..aef44d66df4 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoader.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoader.java
@@ -58,7 +58,7 @@ public final class SQLServerSchemaMetaDataLoader implements
DialectSchemaMetaDat
private static final String INDEX_META_DATA_SQL = "SELECT a.name AS
INDEX_NAME, c.name AS TABLE_NAME FROM sys.indexes a"
+ " JOIN sys.objects c ON a.object_id = c.object_id WHERE
a.index_id NOT IN (0, 255) AND c.name IN (%s)";
-
+
private static final int HIDDEN_COLUMN_START_MAJOR_VERSION = 15;
@Override
@@ -115,7 +115,7 @@ public final class SQLServerSchemaMetaDataLoader implements
DialectSchemaMetaDat
return tables.isEmpty() ? String.format(TABLE_META_DATA_SQL, isHidden)
: String.format(TABLE_META_DATA_SQL_IN_TABLES, isHidden,
tables.stream().map(each -> String.format("'%s'",
each)).collect(Collectors.joining(",")));
}
-
+
private boolean versionContainsHiddenColumn(final DatabaseMetaData
databaseMetaData) throws SQLException {
return databaseMetaData.getDatabaseMajorVersion() >=
HIDDEN_COLUMN_START_MAJOR_VERSION;
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoaderTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoaderTest.java
index be75b6f47be..3759a5da6b2 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoaderTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/SQLServerSchemaMetaDataLoaderTest.java
@@ -42,33 +42,33 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public final class SQLServerSchemaMetaDataLoaderTest {
-
+
private static final String
LOAD_COLUMN_META_DATA_WITHOUT_TABLES_HIGH_VERSION = "SELECT obj.name AS
TABLE_NAME, col.name AS COLUMN_NAME, t.name AS DATA_TYPE,"
+ " col.collation_name AS COLLATION_NAME, col.column_id,
is_identity AS IS_IDENTITY, is_hidden AS IS_HIDDEN,"
+ " (SELECT TOP 1 ind.is_primary_key FROM sys.index_columns ic
LEFT JOIN sys.indexes ind ON ic.object_id = ind.object_id"
+ " AND ic.index_id = ind.index_id AND ind.name LIKE 'PK_%' WHERE
ic.object_id = obj.object_id AND ic.column_id = col.column_id) AS
IS_PRIMARY_KEY"
+ " FROM sys.objects obj INNER JOIN sys.columns col ON
obj.object_id = col.object_id LEFT JOIN sys.types t ON t.user_type_id =
col.user_type_id ORDER BY col.column_id";
-
+
private static final String
LOAD_COLUMN_META_DATA_WITHOUT_TABLES_LOW_VERSION = "SELECT obj.name AS
TABLE_NAME, col.name AS COLUMN_NAME, t.name AS DATA_TYPE,"
+ " col.collation_name AS COLLATION_NAME, col.column_id,
is_identity AS IS_IDENTITY,"
+ " (SELECT TOP 1 ind.is_primary_key FROM sys.index_columns ic
LEFT JOIN sys.indexes ind ON ic.object_id = ind.object_id"
+ " AND ic.index_id = ind.index_id AND ind.name LIKE 'PK_%' WHERE
ic.object_id = obj.object_id AND ic.column_id = col.column_id) AS
IS_PRIMARY_KEY"
+ " FROM sys.objects obj INNER JOIN sys.columns col ON
obj.object_id = col.object_id LEFT JOIN sys.types t ON t.user_type_id =
col.user_type_id ORDER BY col.column_id";
-
+
private static final String LOAD_COLUMN_META_DATA_WITH_TABLES_HIGH_VERSION
= "SELECT obj.name AS TABLE_NAME, col.name AS COLUMN_NAME, t.name AS DATA_TYPE,"
+ " col.collation_name AS COLLATION_NAME, col.column_id,
is_identity AS IS_IDENTITY, is_hidden AS IS_HIDDEN,"
+ " (SELECT TOP 1 ind.is_primary_key FROM sys.index_columns ic
LEFT JOIN sys.indexes ind ON ic.object_id = ind.object_id"
+ " AND ic.index_id = ind.index_id AND ind.name LIKE 'PK_%' WHERE
ic.object_id = obj.object_id AND ic.column_id = col.column_id) AS
IS_PRIMARY_KEY"
+ " FROM sys.objects obj INNER JOIN sys.columns col ON
obj.object_id = col.object_id LEFT JOIN sys.types t ON t.user_type_id =
col.user_type_id"
+ " WHERE obj.name IN ('tbl') ORDER BY col.column_id";
-
+
private static final String LOAD_COLUMN_META_DATA_WITH_TABLES_LOW_VERSION
= "SELECT obj.name AS TABLE_NAME, col.name AS COLUMN_NAME, t.name AS DATA_TYPE,"
+ " col.collation_name AS COLLATION_NAME, col.column_id,
is_identity AS IS_IDENTITY,"
+ " (SELECT TOP 1 ind.is_primary_key FROM sys.index_columns ic
LEFT JOIN sys.indexes ind ON ic.object_id = ind.object_id"
+ " AND ic.index_id = ind.index_id AND ind.name LIKE 'PK_%' WHERE
ic.object_id = obj.object_id AND ic.column_id = col.column_id) AS
IS_PRIMARY_KEY"
+ " FROM sys.objects obj INNER JOIN sys.columns col ON
obj.object_id = col.object_id LEFT JOIN sys.types t ON t.user_type_id =
col.user_type_id"
+ " WHERE obj.name IN ('tbl') ORDER BY col.column_id";
-
+
private static final String LOAD_INDEX_META_DATA = "SELECT a.name AS
INDEX_NAME, c.name AS TABLE_NAME FROM sys.indexes a"
+ " JOIN sys.objects c ON a.object_id = c.object_id WHERE
a.index_id NOT IN (0, 255) AND c.name IN ('tbl')";
@@ -89,7 +89,7 @@ public final class SQLServerSchemaMetaDataLoaderTest {
assertThat(columnsIterator.next(), is(new ColumnMetaData("id", 4,
false, true, true, true)));
assertThat(columnsIterator.next(), is(new ColumnMetaData("name", 12,
false, false, false, false)));
}
-
+
@Test
public void assertLoadWithoutTablesWithLowVersion() throws SQLException {
DataSource dataSource = mockDataSource();
@@ -124,7 +124,7 @@ public final class SQLServerSchemaMetaDataLoaderTest {
assertThat(columnsIterator.next(), is(new ColumnMetaData("id", 4,
false, true, true, true)));
assertThat(columnsIterator.next(), is(new ColumnMetaData("name", 12,
false, false, false, false)));
}
-
+
@Test
public void assertLoadWithTablesWithLowVersion() throws SQLException {
DataSource dataSource = mockDataSource();
diff --git
a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/UnknownSQLException.java
b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/UnknownSQLException.java
index 49cd8e928a6..e2d5a8dac73 100644
---
a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/UnknownSQLException.java
+++
b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/sql/UnknownSQLException.java
@@ -27,6 +27,6 @@ public final class UnknownSQLException extends
ShardingSphereSQLException {
private static final long serialVersionUID = -7357918573504734977L;
public UnknownSQLException(final Exception cause) {
- super(XOpenSQLState.SYNTAX_ERROR, 1999, "Unknown exception: %s",
cause.getMessage());
+ super(XOpenSQLState.SYNTAX_ERROR, 30000, "Unknown exception: %s",
cause.getMessage());
}
}
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/PipelineJobNotFoundException.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/PipelineJobNotFoundException.java
index 7b8f3993eaf..697179dc7d7 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/PipelineJobNotFoundException.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/PipelineJobNotFoundException.java
@@ -28,6 +28,6 @@ public final class PipelineJobNotFoundException extends
ShardingSphereSQLExcepti
private static final long serialVersionUID = -903289953649758722L;
public PipelineJobNotFoundException(final String jobId) {
- super(XOpenSQLState.GENERAL_ERROR, 1201, "Can not find pipeline job
`%s`", jobId);
+ super(XOpenSQLState.GENERAL_ERROR, 15000, "Can not find pipeline job
`%s`", jobId);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
index 1cf82c8d676..05263495f3e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
@@ -28,6 +28,6 @@ public final class ResourceNotExistedException extends
ShardingSphereSQLExceptio
private static final long serialVersionUID = 4146100333670404924L;
public ResourceNotExistedException() {
- super(XOpenSQLState.SYNTAX_ERROR, 1305, "Data source does not exist");
+ super(XOpenSQLState.SYNTAX_ERROR, 11002, "Resource does not exist");
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/RuleNotExistedException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/RuleNotExistedException.java
index 36e4a751356..db64e5f25df 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/RuleNotExistedException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/RuleNotExistedException.java
@@ -28,6 +28,6 @@ public final class RuleNotExistedException extends
ShardingSphereSQLException {
private static final long serialVersionUID = -4150905802300104824L;
public RuleNotExistedException() {
- super(XOpenSQLState.SYNTAX_ERROR, 1305, "Rule does not exist");
+ super(XOpenSQLState.SYNTAX_ERROR, 11003, "Rule does not exist");
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/CircuitBreakException.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/CircuitBreakException.java
index 709974ace77..099545a8620 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/CircuitBreakException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/CircuitBreakException.java
@@ -28,6 +28,6 @@ public final class CircuitBreakException extends
ShardingSphereSQLException {
private static final long serialVersionUID = 6339672680026286798L;
public CircuitBreakException() {
- super(XOpenSQLState.GENERAL_WARNING, 1000, "Circuit break open, the
request has been ignored");
+ super(XOpenSQLState.GENERAL_WARNING, 10000, "Circuit break open, the
request has been ignored");
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/UnsupportedCommandException.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/UnsupportedCommandException.java
index 7411388348b..095b93f962b 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/UnsupportedCommandException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/UnsupportedCommandException.java
@@ -28,6 +28,6 @@ public final class UnsupportedCommandException extends
ShardingSphereSQLExceptio
private static final long serialVersionUID = 8010680371699936338L;
public UnsupportedCommandException(final String commandType) {
- super(XOpenSQLState.SYNTAX_ERROR, 1998, "Unsupported command: %s",
commandType);
+ super(XOpenSQLState.SYNTAX_ERROR, 12000, "Unsupported command: %s",
commandType);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
index 037dae9d49c..029dea010f1 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
@@ -47,9 +47,9 @@ public final class MySQLErrPacketFactoryTest {
@Test
public void assertNewInstanceWithSQLException() {
- MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
SQLException("No reason", "XXX", 9999, new RuntimeException("")));
+ MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
SQLException("No reason", "XXX", 30000, new RuntimeException("")));
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(9999));
+ assertThat(actual.getErrorCode(), is(30000));
assertThat(actual.getSqlState(), is("XXX"));
assertThat(actual.getErrorMessage(), is("No reason"));
}
@@ -153,7 +153,7 @@ public final class MySQLErrPacketFactoryTest {
private void assertShardingSphereConfigurationException(final
MySQLErrPacket actual) {
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(1235));
+ assertThat(actual.getErrorCode(), is(11001));
assertThat(actual.getSqlState(), is("42000"));
assertThat(actual.getErrorMessage(), is("No reason"));
}
@@ -165,7 +165,7 @@ public final class MySQLErrPacketFactoryTest {
private void assertSQLParsingException(final MySQLErrPacket actual) {
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(1235));
+ assertThat(actual.getErrorCode(), is(11000));
assertThat(actual.getSqlState(), is("42000"));
assertThat(actual.getErrorMessage(), is("You have an error in your SQL
syntax"));
}
@@ -183,7 +183,7 @@ public final class MySQLErrPacketFactoryTest {
public void assertNewInstanceWithCircuitBreakException() {
MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
CircuitBreakException());
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(1000));
+ assertThat(actual.getErrorCode(), is(10000));
assertThat(actual.getSqlState(), is("01000"));
assertThat(actual.getErrorMessage(), is("Circuit break open, the
request has been ignored"));
}
@@ -205,7 +205,7 @@ public final class MySQLErrPacketFactoryTest {
public void assertNewInstanceWithUnsupportedCommandException() {
MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
UnsupportedCommandException("No reason"));
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(1998));
+ assertThat(actual.getErrorCode(), is(12000));
assertThat(actual.getSqlState(), is("42000"));
assertThat(actual.getErrorMessage(), is("Unsupported command: No
reason"));
}
@@ -214,7 +214,7 @@ public final class MySQLErrPacketFactoryTest {
public void assertNewInstanceWithOtherException() {
MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
ReflectiveOperationException("No reason"));
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(1999));
+ assertThat(actual.getErrorCode(), is(30000));
assertThat(actual.getSqlState(), is("42000"));
assertThat(actual.getErrorMessage(), is("Unknown exception: No
reason"));
}
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
index 868215dfc96..36a468953b8 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/exception/SQLParsingException.java
@@ -29,14 +29,14 @@ public final class SQLParsingException extends
ShardingSphereSQLException {
private static final long serialVersionUID = -6408790652103666096L;
public SQLParsingException() {
- super(XOpenSQLState.SYNTAX_ERROR, 1235, "You have an error in your SQL
syntax");
+ super(XOpenSQLState.SYNTAX_ERROR, 11000, "You have an error in your
SQL syntax");
}
public SQLParsingException(final String sql) {
- super(XOpenSQLState.SYNTAX_ERROR, 1235, "Unsupported SQL: %s", sql);
+ super(XOpenSQLState.SYNTAX_ERROR, 11000, "Unsupported SQL: %s", sql);
}
public SQLParsingException(final SQLStatementType type) {
- super(XOpenSQLState.SYNTAX_ERROR, 1235, "Unsupported SQL statement
type: `%s`", type.toString());
+ super(XOpenSQLState.SYNTAX_ERROR, 11000, "Unsupported SQL statement
type: `%s`", type.toString());
}
}