From b85e781b40ef599710a2f2ae7fdfba0a75c330a0 Mon Sep 17 00:00:00 2001 From: sta Date: Fri, 9 May 2025 16:29:32 +0900 Subject: [PATCH] [Modify] Throw an exception --- websocket-sharp/WebSocket.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index fbcd65f5..e51b9e18 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -767,10 +767,6 @@ namespace WebSocketSharp /// /// Gets or sets the time to wait for the response to the ping or close. /// - /// - /// The set operation works if the current state of the interface is - /// New or Closed. - /// /// /// /// A that represents the time to wait for @@ -784,6 +780,10 @@ namespace WebSocketSharp /// /// The value specified for a set operation is zero or less. /// + /// + /// The set operation is not available when the current state of + /// the interface is neither New nor Closed. + /// public TimeSpan WaitTime { get { return _waitTime; @@ -797,8 +797,11 @@ namespace WebSocketSharp } lock (_forState) { - if (!canSet ()) - return; + if (!canSet ()) { + var msg = "The set operation is not available."; + + throw new InvalidOperationException (msg); + } _waitTime = value; }