title: WCF Service side Excepion catching FaultException
body: <p>I am in the middle of learning Fault Exception with WCF and am having a little issue. I would like to see if anyone could suggest the appropriate method for doing the following.</p>
  
  <p>The situation, in my example, is that I have a Login service method. When an invalid login attempt is made, I throw a custom fault exception. I also have a try catch in the method so that any other unknown error is caught and sent to the client as a custom Unknown fault exception.</p>
  
  <p>The issue is that when I throw the AuthenticationFault exception, the general exception catch is also grabbing that and forcefully send the UnknownFault instead.</p>
  
  <p>After reviewing the code, I can understand -why- this is happening. So, it leaves me to ask the community how the appropriate way of handling this should be? </p>
  
  <p>Should I not be using a general exception catch in the service and always allow the client to handle this? I didn't really want to use that approach because then how would I handle other possible unknown exceptions on the server and possibly log them?</p>
  
  <p>Is it possible to have a catch state something to the like of "catch any exception -except- faults"?</p>
  
  <p>Thank, code below.</p>
  
  <pre><code>try
  {
      Authenticator AuthTool = new Authenticator();
      if (AuthTool.Authenticate(credentials))
      {
          //--Successful login code
      }
      else
      {
          AuthenticationFault fault = new AuthenticationFault();
          fault.Message = "Invalid Login or Password";
          throw new FaultException&lt;AuthenticationFault&gt;(fault, new FaultReason(fault.Message));
      }
  }
  catch (Exception ex)
  {
      UnknownFault fault = CommonUtil.CreateCommonFault(ex);
      throw new FaultException&lt;UnknownFault&gt;(fault, new FaultReason(fault.ErrorMessage));
  }
  </code></pre>
  
  <p>The "catch (Exception ex)" code above catches the fault exception thrown earlier.</p>
  
  <pre><code>try
  {
      //--proxy call to the service Login method
  }
  catch (FaultException&lt;AuthenticationFault&gt; af)
  {
      //--Never gets here
  }
  catch (FaultException&lt;UnknownFault&gt; uf)
  {
      //--This is what is handling although I threw the AuthenticationFault
  }
  catch (Exception ex)
  {
      //--any other unknown error
  }
  </code></pre>
  
  <p>The above is the client-side error handling</p>