From 6d09887de188a794f2d90f204b3bf1dfc39f8701 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 17 Jan 2018 21:33:53 +0100 Subject: [PATCH] Cleaned up "connection refused" error log --- src/dorkbox/network/connection/EndPointClient.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dorkbox/network/connection/EndPointClient.java b/src/dorkbox/network/connection/EndPointClient.java index bc4ee49f..787f726a 100644 --- a/src/dorkbox/network/connection/EndPointClient.java +++ b/src/dorkbox/network/connection/EndPointClient.java @@ -116,15 +116,16 @@ class EndPointClient extends EndPointBase { 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); }