Skip to content

Commit

Permalink
NCBC-197: Throw meaningful exception when 0 bytes received on socket
Browse files Browse the repository at this point in the history
  • Loading branch information
jzablocki committed Jan 8, 2013
1 parent 23ebf99 commit aa77334
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Enyim.Caching/Memcached/BasicNetworkStream.cs
Expand Up @@ -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)
Expand Down

0 comments on commit aa77334

Please sign in to comment.