Permalink
Browse files

NCBC-197: Throw meaningful exception when 0 bytes received on socket

  • Loading branch information...
1 parent 23ebf99 commit aa77334b37978089521a12c75cdc71efa795d14b @johnzablocki johnzablocki committed Jan 8, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 Enyim.Caching/Memcached/BasicNetworkStream.cs
@@ -89,7 +89,8 @@ public override int Read(byte[] buffer, int offset, int count)
if (errorCode == SocketError.Success && retval > 0)
return retval;
- throw new System.IO.IOException(String.Format("Failed to read from the socket '{0}'. Error: {1}", this.socket.RemoteEndPoint, errorCode == SocketError.Success ? "?" : errorCode.ToString()));
+ string errorMessage = errorCode == SocketError.Success ? "SocketError value was Success, but 0 bytes were received" : errorCode.ToString();
+ throw new System.IO.IOException(String.Format("Failed to read from the socket '{0}'. Error: {1}", this.socket.RemoteEndPoint, errorMessage));
}
public override long Seek(long offset, SeekOrigin origin)

0 comments on commit aa77334

Please sign in to comment.