title: What is the right way to pass on an exception? (C#)
body: <p>I'm wondering what the correct way is to pass on an exception from one method to another.</p>
  
  <p>I'm working on a project that is divided into Presentation (web), Business and Logic layers, and errors (e.g. SqlExceptions) need to be passed down the chain to notify the web layer when something goes wrong.  </p>
  
  <p>I've seen 3 basic approaches:</p>
  
  <pre><code>try  
  {  
      //error code
  } 
  catch (Exception ex)
  {
      throw ex;
  }
  </code></pre>
  
  <p>(simply rethrow)</p>
  
  <pre><code>try  
  {  
      //error code
  } 
  catch (Exception ex)
  {
      throw new MyCustomException();
  }
  </code></pre>
  
  <p>(throw a custom exception, so that a dependency on the data provider is not passed on)<br>
  and then simply  </p>
  
  <pre><code>//error code
  </code></pre>
  
  <p>(not doing anything at all, letting the error bubble up by itself)</p>
  
  <p>Naturally there's some logging happening in the catch block too.  </p>
  
  <p>I prefer number 3, while my colleague uses method 1, but neither of us can really motivate why.</p>
  
  <p>What are the advantages/disadvantages of using each method?  Is there a better method I don't know of?  Is there an accepted Best Way?</p>