[Modify] Throw exception

This commit is contained in:
sta 2017-08-15 16:41:50 +09:00
parent ea19c5d94a
commit e64daf6d81

View File

@ -1148,8 +1148,12 @@ namespace WebSocketSharp.Server
public void SendToAsync (string data, string id, Action<bool> completed) public void SendToAsync (string data, string id, Action<bool> completed)
{ {
IWebSocketSession session; IWebSocketSession session;
if (TryGetSession (id, out session)) if (!TryGetSession (id, out session)) {
session.Context.WebSocket.SendAsync (data, completed); var msg = "The session could not be found.";
throw new ArgumentException (msg, "id");
}
session.Context.WebSocket.SendAsync (data, completed);
} }
/// <summary> /// <summary>