What happens if my IExceptionPublisher throws an Exception?
Posted
by Graphain
on Stack Overflow
See other posts from Stack Overflow
or by Graphain
Published on 2010-06-18T03:23:41Z
Indexed on
2010/06/18
3:33 UTC
Read the original article
Hit count: 651
Hi,
I'm using the .NET Exception Management Application Block (EMAB).
As part of this I am implementing IExceptionPublisher classes.
However, I am wondering what happens if these publishers encounter an Exception.
I had a bit of a look around and apparently they are meant to do something like this:
try
{
/* Normal Exception Publishing */
}
catch
{
ExceptionManager.PublishInternalException(exception, additionalInfo);
}
One caveat: what happens if there is an exception in our custom publisher code, preventing the publishing to MSMQ? For that, we turn to the ExceptionManager.PublishInternalException method, which will publish the exception to the default publisher, which is the Windows application event log.
However, PublishInternalException is both protected and internal so I would have to be implementing ExceptionManager, not IExceptionPublisher, to access it.
© Stack Overflow or respective owner