[Modify] Throw InvalidOperationException

This commit is contained in:
sta 2017-08-21 16:10:29 +09:00
parent 4748abe65b
commit 0bb0cd19b8

View File

@ -1293,25 +1293,25 @@ namespace WebSocketSharp.Server
/// </para>
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="id"/> is an empty string.
/// </exception>
/// <exception cref="InvalidOperationException">
/// <para>
/// <paramref name="id"/> is an empty string.
/// The session could not be found.
/// </para>
/// <para>
/// -or-
/// </para>
/// <para>
/// The session could not be found.
/// The current state of the WebSocket connection is not Open.
/// </para>
/// </exception>
/// <exception cref="InvalidOperationException">
/// The current state of the WebSocket connection is not Open.
/// </exception>
public void SendToAsync (byte[] data, string id, Action<bool> completed)
{
IWebSocketSession session;
if (!TryGetSession (id, out session)) {
var msg = "The session could not be found.";
throw new ArgumentException (msg, "id");
throw new InvalidOperationException (msg);
}
session.Context.WebSocket.SendAsync (data, completed);