Skip to content

Commit

Permalink
fix: more ping server failed message
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Mar 6, 2024
1 parent 4846777 commit c4a7162
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.databend.jdbc.cloud.DatabendCopyParams;
import com.databend.jdbc.cloud.DatabendPresignClient;
import com.databend.jdbc.cloud.DatabendPresignClientV1;
import com.databend.jdbc.exception.DatabendFailedToPingException;
import com.fasterxml.jackson.core.JsonProcessingException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
Expand Down Expand Up @@ -552,7 +553,7 @@ public void executePing(Request request) throws IOException {
if ((response.getStatusCode() < 400)) {
return;
} else {
throw new IOException("failed to ping databend server");
throw new DatabendFailedToPingException(String.format("failed to ping databend server, response code: %s, response message: %s", response.getStatusCode(), response.getStatusMessage()));
}
} catch (RuntimeException e) {
throw new IOException(e);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.databend.jdbc.exception;


public class DatabendFailedToPingException extends RuntimeException {
public DatabendFailedToPingException() {
super();
}

public DatabendFailedToPingException(String message) {
super(message);
}

public DatabendFailedToPingException(String message, Throwable cause) {
super(message, cause);
}

public DatabendFailedToPingException(Throwable cause) {
super(cause);
}

protected DatabendFailedToPingException(
String message,
Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

0 comments on commit c4a7162

Please sign in to comment.