add exception rethrowing

This commit is contained in:
solarin 2020-04-05 16:03:30 +04:00 committed by Andres G. Aragoneses
parent 8de1d7f5ce
commit 7d38536b22

View file

@ -22,7 +22,13 @@ namespace TLSharp.Core.Network
var endpoint = new IPEndPoint(ipAddress, port);
tcpClient = new TcpClient(ipAddress.AddressFamily);
tcpClient.Connect(endpoint);
try {
tcpClient.Connect (endpoint);
} catch (Exception ex) {
throw new Exception ($"Problem when trying to connect to {endpoint}; either there's no internet connection or the IP address version is not compatible (if the latter, consider using DataCenterIPVersion enum)",
ex);
}
}
else
tcpClient = handler(address, port);