mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
add exception rethrowing
This commit is contained in:
parent
8de1d7f5ce
commit
7d38536b22
|
|
@ -22,7 +22,13 @@ namespace TLSharp.Core.Network
|
||||||
var endpoint = new IPEndPoint(ipAddress, port);
|
var endpoint = new IPEndPoint(ipAddress, port);
|
||||||
|
|
||||||
tcpClient = new TcpClient(ipAddress.AddressFamily);
|
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
|
else
|
||||||
tcpClient = handler(address, port);
|
tcpClient = handler(address, port);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue