[Modify] Throw InvalidOperationException
This commit is contained in:
parent
0bb0cd19b8
commit
065aab72c4
@ -1362,24 +1362,26 @@ namespace WebSocketSharp.Server
|
|||||||
/// -or-
|
/// -or-
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <para>
|
/// <para>
|
||||||
|
/// <paramref name="data"/> could not be UTF-8-encoded.
|
||||||
|
/// </para>
|
||||||
|
/// </exception>
|
||||||
|
/// <exception cref="InvalidOperationException">
|
||||||
|
/// <para>
|
||||||
/// The session could not be found.
|
/// The session could not be found.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// -or-
|
/// -or-
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// <paramref name="data"/> could not be UTF-8-encoded.
|
/// The current state of the WebSocket connection is not Open.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </exception>
|
/// </exception>
|
||||||
/// <exception cref="InvalidOperationException">
|
|
||||||
/// The current state of the WebSocket connection is not Open.
|
|
||||||
/// </exception>
|
|
||||||
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)) {
|
||||||
var msg = "The session could not be found.";
|
var msg = "The session could not be found.";
|
||||||
throw new ArgumentException (msg, "id");
|
throw new InvalidOperationException (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
session.Context.WebSocket.SendAsync (data, completed);
|
session.Context.WebSocket.SendAsync (data, completed);
|
||||||
|
Loading…
Reference in New Issue
Block a user