This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 b58c5353755 Refactor UnknownSQLException (#30768)
b58c5353755 is described below
commit b58c5353755e58a29807ee4169f990437f59fc09
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Apr 4 14:23:43 2024 +0800
Refactor UnknownSQLException (#30768)
* Refactor NotClusterModeException
* Refactor InvalidVariableValueException
* Refactor MissingRequiredDatabaseException
* Refactor MissingRequiredDatabaseException
* Refactor PluginNotFoundException
* Refactor UnknownSQLException
---
.../exception/core/external/sql/type/generic/GenericSQLException.java | 2 +-
.../exception/core/external/sql/type/generic/ServerSQLException.java | 2 +-
.../exception/core/external/sql/type/generic/UnknownSQLException.java | 2 +-
.../infra/exception/dialect/SQLExceptionTransformEngineTest.java | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/GenericSQLException.java
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/GenericSQLException.java
index 0d37004dd37..5a2b490d12e 100644
---
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/GenericSQLException.java
+++
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/GenericSQLException.java
@@ -33,7 +33,7 @@ public abstract class GenericSQLException extends
ShardingSphereSQLException {
super(sqlState, TYPE_OFFSET, errorCode, reason, messageArgs);
}
- protected GenericSQLException(final String reason, final Exception cause,
final SQLState sqlState, final int errorCode) {
+ protected GenericSQLException(final String reason, final SQLState
sqlState, final int errorCode, final Exception cause) {
super(sqlState.getValue(), TYPE_OFFSET, errorCode, reason, cause);
}
}
diff --git
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/ServerSQLException.java
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/ServerSQLException.java
index 2ba898650c2..0b28c0bf795 100644
---
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/ServerSQLException.java
+++
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/ServerSQLException.java
@@ -27,6 +27,6 @@ public final class ServerSQLException extends
GenericSQLException {
private static final long serialVersionUID = -4072647406344887711L;
public ServerSQLException(final Exception cause) {
- super(String.format("Server exception: %s", cause.getMessage()),
cause, XOpenSQLState.GENERAL_ERROR, 4);
+ super("Server exception.", XOpenSQLState.GENERAL_ERROR, 4, cause);
}
}
diff --git
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/UnknownSQLException.java
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/UnknownSQLException.java
index f538f64a91a..944828fbd72 100644
---
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/UnknownSQLException.java
+++
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/generic/UnknownSQLException.java
@@ -27,6 +27,6 @@ public final class UnknownSQLException extends
GenericSQLException {
private static final long serialVersionUID = -7357918573504734977L;
public UnknownSQLException(final Exception cause) {
- super("Unknown exception.", cause, XOpenSQLState.GENERAL_ERROR, 0);
+ super("Unknown exception.", XOpenSQLState.GENERAL_ERROR, 0, cause);
}
}
diff --git
a/infra/exception/dialect/core/src/test/java/org/apache/shardingsphere/infra/exception/dialect/SQLExceptionTransformEngineTest.java
b/infra/exception/dialect/core/src/test/java/org/apache/shardingsphere/infra/exception/dialect/SQLExceptionTransformEngineTest.java
index bd2df85ef15..df302238969 100644
---
a/infra/exception/dialect/core/src/test/java/org/apache/shardingsphere/infra/exception/dialect/SQLExceptionTransformEngineTest.java
+++
b/infra/exception/dialect/core/src/test/java/org/apache/shardingsphere/infra/exception/dialect/SQLExceptionTransformEngineTest.java
@@ -72,7 +72,7 @@ class SQLExceptionTransformEngineTest {
SQLException actual =
SQLExceptionTransformEngine.toSQLException(cause, databaseType);
assertThat(actual.getSQLState(), is("HY000"));
assertThat(actual.getErrorCode(), is(30004));
- assertThat(actual.getMessage(), is("Server exception: No reason" +
System.lineSeparator() + "More details: No reason"));
+ assertThat(actual.getMessage(), is("Server exception." +
System.lineSeparator() + "More details: No reason"));
}
@Test