[Modify] Throw exceptions

This commit is contained in:
sta 2016-11-16 16:01:22 +09:00
parent 09e803ffd7
commit 00348958cf

View File

@ -2664,14 +2664,12 @@ namespace WebSocketSharp
/// </param> /// </param>
public void Send (byte[] data) public void Send (byte[] data)
{ {
var msg = _readyState.CheckIfAvailable (false, true, false, false) ?? if (data == null)
CheckSendParameter (data); throw new ArgumentNullException ("data");
if (msg != null) { if (_readyState != WebSocketState.Open) {
_logger.Error (msg); var msg = "The current state of the connection is not Open.";
error ("An error has occurred in sending data.", null); throw new InvalidOperationException (msg);
return;
} }
send (Opcode.Binary, new MemoryStream (data)); send (Opcode.Binary, new MemoryStream (data));