From 34199b5c7afdabeedf61482b21ee3f26ba32ef52 Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 8 May 2025 16:25:35 +0900 Subject: [PATCH] [Modify] Throw an exception --- websocket-sharp/WebSocket.cs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index cb9043e0..fbcd65f5 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -440,10 +440,6 @@ namespace WebSocketSharp /// Gets or sets a value indicating whether the URL redirection for /// the handshake request is allowed. /// - /// - /// The set operation works if the current state of the interface is - /// New or Closed. - /// /// /// /// true if the interface allows the URL redirection for @@ -454,8 +450,17 @@ namespace WebSocketSharp /// /// /// - /// The set operation is not available if the interface is not for - /// the client. + /// + /// The set operation is not available if the interface is not for + /// the client. + /// + /// + /// -or- + /// + /// + /// The set operation is not available when the current state of + /// the interface is neither New nor Closed. + /// /// public bool EnableRedirection { get { @@ -464,14 +469,17 @@ namespace WebSocketSharp set { if (!_isClient) { - var msg = "The interface is not for the client."; + var msg = "The set operation is not available."; throw new InvalidOperationException (msg); } lock (_forState) { - if (!canSet ()) - return; + if (!canSet ()) { + var msg = "The set operation is not available."; + + throw new InvalidOperationException (msg); + } _enableRedirection = value; }