public static Exception HandleSocketException()

in src/Microsoft.Azure.NotificationHubs/ExceptionUtility.cs [118:135]


        public static Exception HandleSocketException(SocketException socketException, int timeoutInMilliseconds, string trackingId)
        {
            var exceptionMessage = socketException.Message;

            switch (socketException.SocketErrorCode)
            {
                case SocketError.AddressNotAvailable:
                case SocketError.ConnectionRefused:
                case SocketError.AccessDenied:
                case SocketError.HostUnreachable:
                case SocketError.HostNotFound:
                    exceptionMessage = string.Format(SRClient.TrackableExceptionMessageFormat, exceptionMessage, CreateClientTrackingExceptionInfo(trackingId));
                    return new MessagingCommunicationException(new MessagingExceptionDetail(ExceptionErrorCodes.ProviderUnreachable, exceptionMessage, ErrorLevelType.ClientConnection, null, trackingId), false, socketException);
                default:
                    exceptionMessage = string.Format(SRClient.TrackableExceptionMessageFormat, string.Format(SRClient.OperationRequestTimedOut, timeoutInMilliseconds), CreateClientTrackingExceptionInfo(trackingId));
                    return new MessagingCommunicationException(new MessagingExceptionDetail(ExceptionErrorCodes.GatewayTimeoutFailure, exceptionMessage, ErrorLevelType.ClientConnection, null, trackingId), true, socketException);
            }
        }