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