Cleaned up "connection refused" error log

This commit is contained in:
nathan 2018-01-17 21:33:53 +01:00
parent c2d6f66030
commit 6d09887de1

View File

@ -116,15 +116,16 @@ class EndPointClient<C extends Connection> extends EndPointBase<C> {
if (!future.isSuccess()) {
Throwable cause = future.cause();
String errorMessage = "Connection refused :" + bootstrapWrapper.address + " at " + bootstrapWrapper.type + " port: " + bootstrapWrapper.port;
if (cause instanceof java.net.ConnectException) {
if (cause.getMessage()
.contains("refused")) {
String errorMessage = "Connection refused to the " + bootstrapWrapper.type + " server at " + bootstrapWrapper.address + " on port: " + bootstrapWrapper.port;
logger.error(errorMessage, cause);
// extra space here is so it aligns with "Connecting to server:"
logger.error(errorMessage);
}
} else {
String errorMessage = "Connection failed to the " + bootstrapWrapper.type + " server at " + bootstrapWrapper.address + " on port: " + bootstrapWrapper.port;
logger.error(errorMessage, cause);
}