From 5a94a05bc7d1216db0515551ab5cb4cd996536e5 Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 17 Nov 2016 04:17:26 +0900 Subject: [PATCH] [Modify] Throw exceptions --- websocket-sharp/WebSocket.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 4f1e2e7a..b3d24b4d 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2689,14 +2689,12 @@ namespace WebSocketSharp /// public void Send (FileInfo file) { - var msg = _readyState.CheckIfAvailable (false, true, false, false) ?? - CheckSendParameter (file); + if (file == null) + throw new ArgumentNullException ("file"); - if (msg != null) { - _logger.Error (msg); - error ("An error has occurred in sending data.", null); - - return; + if (_readyState != WebSocketState.Open) { + var msg = "The current state of the connection is not Open."; + throw new InvalidOperationException (msg); } send (Opcode.Binary, file.OpenRead ());