title: How to rethrow an error in R?
body: <p>I'll catch an error using <a href="https://docs.tibco.com/pub//enterprise-runtime-for-R/1.5.0_may_2013/TERR_1.5.0_LanguageRef/base/conditions.html"><code>tryCatch</code></a>, and attempt to handle the error. However, how can I rethrow the error if I cannot handle the error locally (i.e. delegate to error handlers of parent functions higher up in the call stack)?</p>
  
  <p>I tried using <a href="https://docs.tibco.com/pub//enterprise-runtime-for-R/1.5.0_may_2013/TERR_1.5.0_LanguageRef/base/conditions.html"><code>signalCondition</code></a> but instead of seeing the rethrown error, all I see is <code>NULL</code>:</p>
  
  <pre><code>&gt; error.can.be.handled &lt;- function(e) F
  &gt; 
  &gt; foo &lt;- function() stop("foo stop!")
  &gt; tryCatch(foo(),
  +   error = function(e) {
  +       if (error.can.be.handled(e)) {
  +           # handle error
  +       }
  +       else
  +           signalCondition(e) # Rethrow error
  +   }
  + )
  NULL  # I expected to see 'Error in foo() : foo stop!' here
  </code></pre>
  
  <p>What's going wrong?</p>