Fix a few for pull request #69

This commit is contained in:
sta 2014-08-21 20:48:37 +09:00
parent 8b2ff1012a
commit e41e627ebc
2 changed files with 36 additions and 16 deletions

View File

@ -26,6 +26,13 @@
*/ */
#endregion #endregion
#region Contributors
/*
* Contributors:
* - Frank Razenberg <frank@zzattack.org>
*/
#endregion
using System; using System;
namespace WebSocketSharp namespace WebSocketSharp
@ -42,8 +49,8 @@ namespace WebSocketSharp
{ {
#region Private Fields #region Private Fields
private string _message;
private Exception _exception; private Exception _exception;
private string _message;
#endregion #endregion
@ -64,6 +71,19 @@ namespace WebSocketSharp
#region Public Properties #region Public Properties
/// <summary>
/// Gets the exception that caused the error.
/// </summary>
/// <value>
/// A <see cref="System.Exception"/> instance that represents the cause of the error,
/// or <see langword="null"/> if the error isn't due to an exception.
/// </value>
public Exception Exception {
get {
return _exception;
}
}
/// <summary> /// <summary>
/// Gets the error message. /// Gets the error message.
/// </summary> /// </summary>
@ -76,18 +96,6 @@ namespace WebSocketSharp
} }
} }
/// <summary>
/// Gets the exception that caused the error.
/// </summary>
/// A <see cref="Exception"/> instance that represents the cause of the error,
/// or <see langword="null"/> if the error isn't due to an exception.
/// </value>
public Exception Exception {
get {
return _exception;
}
}
#endregion #endregion
} }
} }

View File

@ -32,6 +32,13 @@
*/ */
#endregion #endregion
#region Contributors
/*
* Contributors:
* - Frank Razenberg <frank@zzattack.org>
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -856,10 +863,15 @@ namespace WebSocketSharp
_messageEventQueue.Enqueue (e); _messageEventQueue.Enqueue (e);
} }
private void error (string message, Exception exc = null) private void error (string message)
{
error (message, null);
}
private void error (string message, Exception exception)
{ {
try { try {
OnError.Emit (this, new ErrorEventArgs (message, exc)); OnError.Emit (this, new ErrorEventArgs (message, exception));
} }
catch (Exception ex) { catch (Exception ex) {
_logger.Fatal ("An exception has occurred while OnError:\n" + ex.ToString ()); _logger.Fatal ("An exception has occurred while OnError:\n" + ex.ToString ());