Browse Source

[Modify] Throw an exception

pull/571/merge
sta 3 months ago
parent
commit
8469533c26
  1. 20
      websocket-sharp/WebSocket.cs

20
websocket-sharp/WebSocket.cs

@ -341,8 +341,17 @@ namespace WebSocketSharp
/// </para> /// </para>
/// </value> /// </value>
/// <exception cref="InvalidOperationException"> /// <exception cref="InvalidOperationException">
/// The set operation is not available if the interface is not for
/// the client.
/// <para>
/// The set operation is not available if the interface is not for
/// the client.
/// </para>
/// <para>
/// -or-
/// </para>
/// <para>
/// The set operation is not available when the current state of
/// the interface is neither New nor Closed.
/// </para>
/// </exception> /// </exception>
public CompressionMethod Compression { public CompressionMethod Compression {
get { get {
@ -357,8 +366,11 @@ namespace WebSocketSharp
} }
lock (_forState) { lock (_forState) {
if (!canSet ())
return;
if (!canSet ()) {
var msg = "The current state of the interface is neither New nor Closed.";
throw new InvalidOperationException (msg);
}
_compression = value; _compression = value;
} }

Loading…
Cancel
Save