public static Exception CreateResponseIOException(IOException ioException, TimeSpan receiveTimeout) { if (ioException.InnerException is SocketException) { return(SocketConnection.ConvertTransferException((SocketException)ioException.InnerException, receiveTimeout, ioException)); } return(new CommunicationException(System.ServiceModel.SR.GetString("HttpTransferError", new object[] { ioException.Message }), ioException)); }
public static Exception CreateRequestIOException(IOException ioException, HttpWebRequest request, Exception originalException) { Exception exception = (originalException == null) ? ioException : originalException; if (ioException.InnerException is SocketException) { return(SocketConnection.ConvertTransferException((SocketException)ioException.InnerException, TimeSpan.FromMilliseconds((double)request.Timeout), exception)); } return(new CommunicationException(System.ServiceModel.SR.GetString("HttpTransferError", new object[] { exception.Message }), exception)); }