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
#region Contributors
/*
* Contributors:
* - Frank Razenberg <frank@zzattack.org>
*/
#endregion
using System;
namespace WebSocketSharp
@ -42,8 +49,8 @@ namespace WebSocketSharp
{
#region Private Fields
private string _message;
private Exception _exception;
private string _message;
#endregion
@ -63,7 +70,20 @@ namespace WebSocketSharp
#endregion
#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>
/// Gets the error message.
/// </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
}
}

View File

@ -32,6 +32,13 @@
*/
#endregion
#region Contributors
/*
* Contributors:
* - Frank Razenberg <frank@zzattack.org>
*/
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
@ -856,10 +863,15 @@ namespace WebSocketSharp
_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 {
OnError.Emit (this, new ErrorEventArgs (message, exc));
OnError.Emit (this, new ErrorEventArgs (message, exception));
}
catch (Exception ex) {
_logger.Fatal ("An exception has occurred while OnError:\n" + ex.ToString ());