From 5a2be240023139285aaafe2d98f10b64904dc362 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 9 Sep 2014 11:08:59 +0900 Subject: [PATCH] Refactored WebSocketException.cs --- websocket-sharp/WebSocketException.cs | 28 ++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/websocket-sharp/WebSocketException.cs b/websocket-sharp/WebSocketException.cs index 1bb64efe..3380eaab 100644 --- a/websocket-sharp/WebSocketException.cs +++ b/websocket-sharp/WebSocketException.cs @@ -35,6 +35,12 @@ namespace WebSocketSharp /// public class WebSocketException : Exception { + #region Private Fields + + private CloseStatusCode _code; + + #endregion + #region Internal Constructors internal WebSocketException () @@ -42,6 +48,11 @@ namespace WebSocketSharp { } + internal WebSocketException (Exception innerException) + : this (CloseStatusCode.Abnormal, null, innerException) + { + } + internal WebSocketException (string message) : this (CloseStatusCode.Abnormal, message, null) { @@ -57,6 +68,11 @@ namespace WebSocketSharp { } + internal WebSocketException (CloseStatusCode code, Exception innerException) + : this (code, null, innerException) + { + } + internal WebSocketException (CloseStatusCode code, string message) : this (code, message, null) { @@ -65,7 +81,7 @@ namespace WebSocketSharp internal WebSocketException (CloseStatusCode code, string message, Exception innerException) : base (message ?? code.GetMessage (), innerException) { - Code = code; + _code = code; } #endregion @@ -73,14 +89,16 @@ namespace WebSocketSharp #region Public Properties /// - /// Gets the status code indicating the cause for the exception. + /// Gets the status code indicating the cause of the exception. /// /// - /// One of the enum values, represents the status code indicating - /// the cause for the exception. + /// One of the enum values, represents the status code + /// indicating the cause of the exception. /// public CloseStatusCode Code { - get; private set; + get { + return _code; + } } #endregion