[Modify] Throw exceptions
This commit is contained in:
parent
946e64c79d
commit
5a94a05bc7
@ -2689,14 +2689,12 @@ namespace WebSocketSharp
|
|||||||
/// </param>
|
/// </param>
|
||||||
public void Send (FileInfo file)
|
public void Send (FileInfo file)
|
||||||
{
|
{
|
||||||
var msg = _readyState.CheckIfAvailable (false, true, false, false) ??
|
if (file == null)
|
||||||
CheckSendParameter (file);
|
throw new ArgumentNullException ("file");
|
||||||
|
|
||||||
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, file.OpenRead ());
|
send (Opcode.Binary, file.OpenRead ());
|
||||||
|
Loading…
Reference in New Issue
Block a user