[Modify] Throw exception

This commit is contained in:
sta 2017-08-11 15:37:20 +09:00
parent 7dcd3cd2e3
commit d774b41474

View File

@ -891,7 +891,12 @@ namespace WebSocketSharp.Server
public bool PingTo (string id) public bool PingTo (string id)
{ {
IWebSocketSession session; IWebSocketSession session;
return TryGetSession (id, out session) && session.Context.WebSocket.Ping (); if (!TryGetSession (id, out session)) {
var msg = "The session could not be found.";
throw new ArgumentException (msg, "id");
}
return session.Context.WebSocket.Ping ();
} }
/// <summary> /// <summary>