title: How can I pass on an Exception?
body: <p>Basically, what I want to do is pass a specific Exception to a more general Exception within the same try block. I've tried the following and it doesn't work:</p>
  
  <pre><code>    static bool example(int count = 0)
      {
          try
          {
              work();
          }
          catch (TimeoutException e)
          {
              if (count &lt; 3)
              {
                  Console.WriteLine("Caught TimeoutException: {0}", e.Message);
                  return example(count + 1);
              }
              else
              {
                  throw new Exception(e.Message);
              }
          }
          catch (Exception e)
          {
              Console.WriteLine("Caught Exception: {0}", e.Message + " rethrown");
              return false;
          }
          return true;
      }
  
      static void work()
      {
          throw new TimeoutException("test");
      }
  </code></pre>
  
  <p>I want the <code>TimeoutException</code> to be only handled a certain amount of times before going to a more generic <code>Exception</code>. This is because the <code>TimeoutException</code> has additional information about the exception on a case by case basis.  I do not want to duplicate the code for <code>Exception</code> under the <code>else</code> clause of <code>TimeoutException</code>. The reason I want all exceptions to be handled is that there may be other unknown exceptions that are thrown.  The nature of the program requires it to not crash so I must account for any other exceptions and log them.  How can I implement this?</p>