Skip to content

Commit c4ce935

Browse files
committed
add zk session expired error
1 parent 64c2050 commit c4ce935

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/main/java/com/dtstack/flink/sql/enums/EConnectionErrorCode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
public enum EConnectionErrorCode {
3232
ERROR_NOT_MATCH(0, "错误信息未匹配", new String[]{}),
33-
CONN_DB_INVALID(1, "数据库连接失效,请重新打开", new String[]{"the last packet successfully received from the server was"}),
33+
CONN_DB_INVALID(1, "数据库连接失效,请重新打开", new String[]{"the last packet successfully received from the server was", "Zookeeper session has been expired"}),
3434
CONN_DB_FAILED(2, "数据库连接失败,请检查用户名或密码是否正确", new String[]{"Access denied for user"}),
3535
DB_TABLE_NOT_EXIST(3, "操作的表名不存在", new String[]{"doesn't exist"});
3636

core/src/test/java/com/dtstack/flink/sql/side/EConnectionErrorCodeTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public void testResolveErrorCodeFromException(){
3434
EConnectionErrorCode errorCode =
3535
EConnectionErrorCode.resolveErrorCodeFromException(new Exception("The last packet successfully received from the server was 179 milliseconds"));
3636

37+
EConnectionErrorCode ckSessionExpired =
38+
EConnectionErrorCode.resolveErrorCodeFromException(new Exception("Excepetion: Zookeeper session has been expired"));
39+
3740
Assert.assertEquals(errorCode, EConnectionErrorCode.CONN_DB_INVALID);
41+
Assert.assertEquals(ckSessionExpired, EConnectionErrorCode.CONN_DB_INVALID);
3842
}
3943
}

0 commit comments

Comments
 (0)