I have to implement a IExceptionHandler for the Enteprise Library 4.1. In my particular case I want to use it to log the exception to Fogbugz but the inner details is not what I am asking about. What I need is how to - best practicies - implement it, How to get the config for a app.config or web.config. etc.
I have code This so far:
public class LcpFogbugzExceptionHandler : IExceptionHandler {
/// <summary>
/// Initializes a new instance of the <see cref="LcpFogbugzExceptionHandler"/> class.
/// </summary>
public LcpFogbugzExceptionHandler() {
// <param name="ignore">The ignore.</param>
//NameValueCollection ignore
}
/// <summary>
/// Initializes a new instance of the <see cref="T:LcpFogbugzExceptionHandler"/> class.
/// </summary>
/// <param name="ignore">The ignore.</param>
public LcpFogbugzExceptionHandler(NameValueCollection ignore) {
}
/// <summary>
/// Handles the exception.
/// </summary>
/// <param name="exception">The exception.</param>
/// <param name="handlingInstanceId">The handling instance id.</param>
/// <returns></returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1300:SpecifyMessageBoxOptions"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Convert.ToBoolean(System.String)")]
public Exception HandleException(Exception exception, Guid handlingInstanceId) {
// Perform processing here. The exception returned will be passed to the next
// exception handler in the chain.
return exception;
}
}