title: nested tryCatch not catching error?
body: <p>I have a function:</p>
  
  <pre><code>buggy &lt;- function(...) {
      tryCatch({
          itWorked &lt;- FALSE
          stop("I don't like green eggs and ham!")
          itWorked &lt;- TRUE
      }, finally = {
          if ( itWorked )
              return("I do, Sam I am")
          else
              return("I do not like them, Sam I am!")
      })
  }
  </code></pre>
  
  <p>Basically, <code>buggy</code> tries to do some calculations that may or may not succeed (determined by <code>itWorked</code>. The <code>finally</code> clause just makes sure that even if the calculation didn't work, something gets returned (in this case, <code>"I do not like them, Sam I am!"</code>).</p>
  
  <p>It works as expected:</p>
  
  <pre><code>&gt; buggy()
  Error in tryCatchList(expr, classes, parentenv, handlers) : 
    I don't like green eggs and ham!
  [1] "I do not like them, Sam I am!"
  </code></pre>
  
  <p>Now I want to listen for errors in <code>buggy()</code>:</p>
  
  <pre><code>tryCatch( buggy(), 
            error=function(e) message('too bad! there was an error') )
  </code></pre>
  
  <p>However the error in <code>buggy</code> fails to raise an error in the surrounding <code>tryCatch</code>:</p>
  
  <pre><code>&gt; tryCatch( buggy(), 
  +           error=function(e) message('too bad! there was an error') )
  [1] "I do not like them, Sam I am!"
  </code></pre>
  
  <p>I would expect this to say:</p>
  
  <pre><code>'too bad! there was an error'
  [1] "I do not like them, Sam I am!"
  </code></pre>
  
  <p>Can anyone tell me why this does not work? Do I somehow need to 'raise' errors from within <code>buggy</code>?</p>