Browse files

Merge pull request #6 from jzablocki/master

NCBC-197: Throw meaningful exception when 0 bytes received on socket
  • Loading branch information...
2 parents 8483ddf + aa77334 commit e7061273bace73f26c2d44d77da7f2bae9d480bc @jzablocki committed Jan 30, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 Enyim.Caching/Memcached/BasicNetworkStream.cs
View
3 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 e706127

Please sign in to comment.