Skip to content

Commit 7ec7b8e

Browse files
authored
handle nested exceptions in exception handlers (#1605)
1 parent 42803c9 commit 7ec7b8e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

wrapper/src/main/java/software/amazon/jdbc/exceptions/AbstractPgExceptionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public boolean isNetworkException(final Throwable throwable, @Nullable TargetDri
4141
if (exception instanceof SQLException) {
4242
return isNetworkException(((SQLException) exception).getSQLState());
4343
} else if (targetDriverDialect != null) {
44-
String sqlState = targetDriverDialect.getSQLState(throwable);
44+
String sqlState = targetDriverDialect.getSQLState(exception);
4545
if (!StringUtils.isNullOrEmpty(sqlState)) {
4646
return isNetworkException(sqlState);
4747
}

wrapper/src/main/java/software/amazon/jdbc/exceptions/GenericExceptionHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public boolean isNetworkException(final Throwable throwable, @Nullable TargetDri
5252
if (exception instanceof SQLException) {
5353
return isNetworkException(((SQLException) exception).getSQLState());
5454
} else if (targetDriverDialect != null) {
55-
String sqlState = targetDriverDialect.getSQLState(throwable);
55+
String sqlState = targetDriverDialect.getSQLState(exception);
5656
if (!StringUtils.isNullOrEmpty(sqlState)) {
5757
return isNetworkException(sqlState);
5858
}
@@ -98,7 +98,7 @@ public boolean isLoginException(final Throwable throwable, TargetDriverDialect t
9898
if (exception instanceof SQLException) {
9999
sqlState = ((SQLException) exception).getSQLState();
100100
} else if (targetDriverDialect != null) {
101-
sqlState = targetDriverDialect.getSQLState(throwable);
101+
sqlState = targetDriverDialect.getSQLState(exception);
102102
}
103103

104104
if (isLoginException(sqlState)) {

wrapper/src/main/java/software/amazon/jdbc/exceptions/MySQLExceptionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public boolean isNetworkException(final Throwable throwable, @Nullable TargetDri
5353
return true;
5454
}
5555
} else if (targetDriverDialect != null) {
56-
String sqlState = targetDriverDialect.getSQLState(throwable);
56+
String sqlState = targetDriverDialect.getSQLState(exception);
5757
if (!StringUtils.isNullOrEmpty(sqlState)) {
5858
return isNetworkException(sqlState);
5959
}

0 commit comments

Comments
 (0)