[Modify] Throw exceptions
This commit is contained in:
parent
17bc2aaab8
commit
7e62581cc3
@ -2825,12 +2825,14 @@ namespace WebSocketSharp
|
|||||||
/// </param>
|
/// </param>
|
||||||
public void CloseAsync (CloseStatusCode code)
|
public void CloseAsync (CloseStatusCode code)
|
||||||
{
|
{
|
||||||
string msg;
|
if (_client && code == CloseStatusCode.ServerError) {
|
||||||
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
var msg = "ServerError cannot be used.";
|
||||||
_logger.Error (msg);
|
throw new ArgumentException (msg, "code");
|
||||||
error ("An error has occurred in closing the connection.", null);
|
}
|
||||||
|
|
||||||
return;
|
if (!_client && code == CloseStatusCode.MandatoryExtension) {
|
||||||
|
var msg = "MandatoryExtension cannot be used.";
|
||||||
|
throw new ArgumentException (msg, "code");
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAsync ((ushort) code, String.Empty);
|
closeAsync ((ushort) code, String.Empty);
|
||||||
|
Loading…
Reference in New Issue
Block a user