Index: OnlyOnceErrorHandler.cs
===================================================================
--- OnlyOnceErrorHandler.cs (revision 441808)
+++ OnlyOnceErrorHandler.cs (working copy)
@@ -1,6 +1,6 @@
#region Copyright & License
//
-// Copyright 2001-2005 The Apache Software Foundation
+// Copyright 2001-2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@
///
/// Nicko Cadell
/// Gert Driesen
+ /// Ron Grabowski
public class OnlyOnceErrorHandler : IErrorHandler
{
#region Public Instance Constructors
@@ -90,7 +91,11 @@
{
if (IsEnabled)
{
- LogLog.Error("[" + m_prefix + "] " + message, e);
+ m_errorCode = errorCode;
+ m_exception = e;
+ m_message = message;
+
+ LogLog.Error("[" + m_prefix + "] ErrorCode: " + errorCode.ToString() + ". " + message, e);
}
}
@@ -106,11 +111,8 @@
///
///
public void Error(string message, Exception e)
- {
- if (IsEnabled)
- {
- LogLog.Error("[" + m_prefix + "] " + message, e);
- }
+ {
+ Error(message, e, ErrorCode.GenericFailure);
}
///
@@ -125,10 +127,7 @@
///
public void Error(string message)
{
- if (IsEnabled)
- {
- LogLog.Error("[" + m_prefix + "] " + message);
- }
+ Error(message, null, ErrorCode.GenericFailure);
}
#endregion Implementation of IErrorHandler
@@ -162,6 +161,43 @@
}
}
+ #region Public Instance Properties
+
+ ///
+ /// The message from the first error that trigged this error handler.
+ ///
+ public string ErrorMessage
+ {
+ get { return this.m_message; }
+ set { this.m_message = value; }
+ }
+
+ ///
+ /// The exception from the first error that trigged this error handler.
+ ///
+ ///
+ /// May be .
+ ///
+ public Exception Exception
+ {
+ get { return this.m_exception; }
+ set { this.m_exception = value; }
+ }
+
+ ///
+ /// The error code from the first error that trigged this error handler.
+ ///
+ ///
+ /// Defaults to
+ ///
+ public ErrorCode ErrorCode
+ {
+ get { return this.m_errorCode; }
+ set { this.m_errorCode = value; }
+ }
+
+ #endregion
+
#region Private Instance Fields
///
@@ -170,6 +206,21 @@
private bool m_firstTime = true;
///
+ /// The message recorded during the first error.
+ ///
+ private string m_message = null;
+
+ ///
+ /// The exception recorded during the first error.
+ ///
+ private Exception m_exception = null;
+
+ ///
+ /// The error code recorded during the first error.
+ ///
+ private ErrorCode m_errorCode = ErrorCode.GenericFailure;
+
+ ///
/// String to prefix each message with
///
private readonly string m_prefix;