title: Powershell try/catch rethrow not propagating error (Powershell 2.0)
body: <p>I have a try-catch statement within a try-catch statement. The inner catch catches the error, but the throw does not cause the error to be caught in the out catch statement. Breifly, my script is formatted similar to:</p>
  
  <pre><code>$ErrorPreference = "Stop"
  
  try
  {
       getStuffFromDB
  
       putStuffInDB
  }
  catch
  {
       write-host ("Error: " + $error[0])
  }
  
  function getStuffFromDB
  {
       try
       {
            -- database query statement
       }
       catch
       {
            throw
       }
       finally
       {
            close connection and clean up
       }
  }
  
  function putStuffInDB
  {
       try
       {
            -- database insert statements statement
       }
       catch
       {
            throw
       }
       finally
       {
            close connection and clean up
       }
  }
  </code></pre>
  
  <p>When I ran the script there were no errors, but I noticed the SQL Server database that I was attempting to populate was missing data. When I re-ran the script in debug, the function 'putStuffInDB' had an error that was caught in the catch block. But when I stepped the message did not get 'thrown' to the outer catch block, but processed the finally block and terminated.</p>
  
  <p>I am obviously missing something that I am not seeing. I have used the construct in C# in the past and never had issues with errors being 'passed' to the outer catch block.</p>