What happens if my IExceptionPublisher throws an exception?

I use . Exception Management Application Block (EMAB).

As part of this, I am implementing the IExceptionPublisher classes.

However, I wonder what happens if these publishers run into Exception.

I had a little look back and obviously , they should do something like this:

try 
{
    /* Normal Exception Publishing */
}
catch
{
    ExceptionManager.PublishInternalException(exception, additionalInfo);
}

Source :

One warning: what happens if there is an exception in our custom code publisher, preventing MSMQ from being published? To do this, we turn to the ExceptionManager.PublishInternalException method, which will throw an exception for the default publisher, which is the event of the Windows application log in.

PublishInternalException , , ExceptionManager, IExceptionPublisher.

+3
1

, , , IExceptionPublisher

PublishInternalException -. ExceptionManager IExceptionPublisher try-catch, PublishInternalException. Reflector, :

/* Foreach publisher */
Exception originalException;
try
{
    PublishToCustomPublisher(originalException, additionalInfo, current);
}
catch (Exception publisherException)
{
    /* Both of these calls use the DefaultPublisher which is the Application Log */
    PublishInternalException(publisherException, null);
    PublishToDefaultPublisher(originalException, additionalInfo);
}

Enterprise Library

0

Source: https://habr.com/ru/post/1750617/


All Articles