[Modify] Throw exceptions
This commit is contained in:
parent
8df303f1f6
commit
9543252eb2
@ -2767,12 +2767,19 @@ namespace WebSocketSharp
|
|||||||
/// </param>
|
/// </param>
|
||||||
public void CloseAsync (ushort code)
|
public void CloseAsync (ushort code)
|
||||||
{
|
{
|
||||||
string msg;
|
if (!code.IsCloseStatusCode ()) {
|
||||||
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
var msg = "Less than 1000 or greater than 4999.";
|
||||||
_logger.Error (msg);
|
throw new ArgumentOutOfRangeException ("code", msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
}
|
||||||
|
|
||||||
return;
|
if (_client && code == 1011) {
|
||||||
|
var msg = "1011 cannot be used.";
|
||||||
|
throw new ArgumentException (msg, "code");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_client && code == 1010) {
|
||||||
|
var msg = "1010 cannot be used.";
|
||||||
|
throw new ArgumentException (msg, "code");
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAsync (code, String.Empty);
|
closeAsync (code, String.Empty);
|
||||||
|
Loading…
Reference in New Issue
Block a user