From eda5f38d0b8b22deb3680f054738f9befe5de5a3 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 5 May 2018 20:43:17 +0900 Subject: [PATCH] [Modify] Throw exceptions --- websocket-sharp/Server/WebSocketBehavior.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs index 2996e6da..43fe9d29 100644 --- a/websocket-sharp/Server/WebSocketBehavior.cs +++ b/websocket-sharp/Server/WebSocketBehavior.cs @@ -399,8 +399,13 @@ namespace WebSocketSharp.Server /// protected void Error (string message, Exception exception) { - if (message != null && message.Length > 0) - OnError (new ErrorEventArgs (message, exception)); + if (message == null) + throw new ArgumentNullException ("message"); + + if (message.Length == 0) + throw new ArgumentException ("An empty string.", "message"); + + OnError (new ErrorEventArgs (message, exception)); } ///