title: How to design a fluent interface (for exception handling)?
body: <p>I am reviewing part of a code base, and I come to the exception handling part which is really messy. I would like to replace it with something more elegant. Then I thought it might not be a bad idea if I could have a fluent interface in place that would help me register some policy for a list of exceptions, and let an ExceptionHandlingManager do the rest for me :</p>
  
  <p>Here's an example how it should work:</p>
  
  <pre><code>For&lt;TException&gt;.RegisterPolicy&lt;TPolicy&gt;(a lambda expression that describes the detail);
  </code></pre>
  
  <p>but I am totally lost. Am I on the right track? When we want to design a fluent interface like this, what's the best approach? I mean if fluent interfaces are part of DSLs, then is designing a fluent interface like designing a language?</p>
  
  <hr>
  
  <p>This module that I am talking about it's a general module that is responsible for all not handled exceptions.and it's a module of hundred lines like this :</p>
  
  <pre><code>if(exp.GetType()==typeof(expType1))
  {
      if(exp.Message.Include("something went bad"))
      // do list of things things like perform logging to database 
      // and translating/reporting it to user
  }
  else if (exp.GetType()==typeof(expType2))
  {
      //do some other list of things...
      ...
  }
  </code></pre>