Refactored WebSocketException.cs

This commit is contained in:
sta 2014-03-22 17:03:53 +09:00
parent cd8b703578
commit d87e60c146

View File

@ -31,8 +31,7 @@ using System;
namespace WebSocketSharp namespace WebSocketSharp
{ {
/// <summary> /// <summary>
/// Represents the exception that occurred when attempting to perform an /// The exception that is thrown when a <see cref="WebSocket"/> gets a fatal error.
/// operation on the WebSocket connection.
/// </summary> /// </summary>
public class WebSocketException : Exception public class WebSocketException : Exception
{ {
@ -43,13 +42,13 @@ namespace WebSocketSharp
{ {
} }
internal WebSocketException (CloseStatusCode code) internal WebSocketException (string reason)
: this (code, null, null) : this (CloseStatusCode.Abnormal, reason, null)
{ {
} }
internal WebSocketException (string reason) internal WebSocketException (CloseStatusCode code)
: this (CloseStatusCode.Abnormal, reason, null) : this (code, null, null)
{ {
} }
@ -63,8 +62,7 @@ namespace WebSocketSharp
{ {
} }
internal WebSocketException ( internal WebSocketException (CloseStatusCode code, string reason, Exception innerException)
CloseStatusCode code, string reason, Exception innerException)
: base (reason ?? code.GetMessage (), innerException) : base (reason ?? code.GetMessage (), innerException)
{ {
Code = code; Code = code;
@ -75,12 +73,11 @@ namespace WebSocketSharp
#region Public Properties #region Public Properties
/// <summary> /// <summary>
/// Gets the <see cref="CloseStatusCode"/> associated with the /// Gets the status code indicating the cause for the exception.
/// <see cref="WebSocketException"/>.
/// </summary> /// </summary>
/// <value> /// <value>
/// One of the <see cref="CloseStatusCode"/> values, indicates the cause of /// One of the <see cref="CloseStatusCode"/> enum values, represents the status code indicating
/// the <see cref="WebSocketException"/>. /// the cause for the exception.
/// </value> /// </value>
public CloseStatusCode Code { public CloseStatusCode Code {
get; private set; get; private set;