From cf50e89001317d36fbb1bb9561c524f43b5f23c5 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 21 Sep 2021 19:43:53 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Server/WebSocketServiceManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/websocket-sharp/Server/WebSocketServiceManager.cs b/websocket-sharp/Server/WebSocketServiceManager.cs index 27acb007..cc9dc745 100644 --- a/websocket-sharp/Server/WebSocketServiceManager.cs +++ b/websocket-sharp/Server/WebSocketServiceManager.cs @@ -515,10 +515,11 @@ namespace WebSocketSharp.Server throw new ArgumentException ("An empty string.", "path"); if (path[0] != '/') - throw new ArgumentException ("Not an absolute path.", "path"); + throw new ArgumentException ("It is not an absolute path.", "path"); if (path.IndexOfAny (new[] { '?', '#' }) > -1) { var msg = "It includes either or both query and fragment components."; + throw new ArgumentException (msg, "path"); } @@ -526,8 +527,9 @@ namespace WebSocketSharp.Server lock (_sync) { WebSocketServiceHost host; + if (_hosts.TryGetValue (path, out host)) - throw new ArgumentException ("Already in use.", "path"); + throw new ArgumentException ("It is already in use.", "path"); host = new WebSocketServiceHost ( path, () => new TBehavior (), initializer, _log