Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit a2e1810

Browse files
VincentDondainspouliot
authored andcommitted
Improve logging for failed TCP connections due to hostname (#51)
1 parent 1c41c75 commit a2e1810

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

NUnitLite/TouchRunner/TouchRunner.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ static string SelectHostName (string[] names, int port)
210210
result = name;
211211
}
212212
evt.Set ();
213-
} catch (Exception) {
213+
} catch (Exception e) {
214214
lock (lock_obj) {
215+
Console.WriteLine ("TCP connection failed when selecting 'hostname': {0} and 'port': {1}. {2}", name, port, e);
215216
failures++;
216217
if (failures == names.Length)
217218
evt.Set ();
@@ -266,8 +267,10 @@ public bool OpenWriter (string message)
266267
goto case "TCP";
267268
case "TCP":
268269
hostname = SelectHostName (options.HostName.Split (','), options.HostPort);
269-
if (string.IsNullOrEmpty (hostname))
270+
if (string.IsNullOrEmpty (hostname)) {
271+
Console.WriteLine ("Couldn't establish a TCP connection with any of the hostnames: {0}", options.HostName);
270272
break;
273+
}
271274
Console.WriteLine ("[{0}] Sending '{1}' results to {2}:{3}", now, message, hostname, options.HostPort);
272275
defaultWriter = new TcpTextWriter (hostname, options.HostPort);
273276
break;

0 commit comments

Comments
 (0)