diff --git a/examples/csharp/Socket.cs b/examples/csharp/Socket.cs index f50414f..28d1bab 100644 --- a/examples/csharp/Socket.cs +++ b/examples/csharp/Socket.cs @@ -23,6 +23,16 @@ using ZeroTier; /// namespace ZeroTier { + public class ZeroTierException : Exception + { + public ZeroTierException(int _serviceErrorCode, int _socketErrorCode) { + ServiceErrorCode = _serviceErrorCode; + SocketErrorCode = _socketErrorCode; + } + public int ServiceErrorCode { get; set; } + public int SocketErrorCode { get; set; } + } + /// /// ZeroTier Socket - An lwIP socket mediated over a ZeroTier virtual link /// @@ -172,7 +182,7 @@ namespace ZeroTier */ } if (err < 0) { - throw new SocketException((int)err); + throw new ZeroTierException(err, ZeroTier.Node.ErrNo); } _remoteEndPoint = remoteEndPoint; }