WCF error-handling extension + exception/logger application block?

May 27, 2008 at 2:36 PM
Hello

I'm new to the exception and logger application block and I wonder if I'm doing this right. I want to log any or selected exceptions that occur in my WCF-services
and wonder if it is a good idea to implement a WCF error-handler extension that looks like this:

public class ErrorLogger : IErrorHandler

{

    public bool HandleError(Exception error)

    {

        ExceptionPolicy.HandleException(error, "Service Exception Policy");

        return false;

    }


    public void ProvideFault(Exception error, MessageVersion version, ref Message fault)

    {

    }

}


WCF calls HandleError() when an exception occurs and after the control is returned to the client. I will not be able to continue the execution of my
service after an exception occurs and the exception will always propagate to the client. Is there any problem with this? The client will get an
FaultException if an unhandled/unexpected exception occurs or a more specific FaultException<T> if the exception is thrown and the client
must be able to distinguish between different exceptions.

Regards,
Opwiz