title: How to explain whether Exception will catch RuntimeException?
body: <p>This is very odd to me. <code>RuntimeException</code> inherits from <code>Exception</code>, which inherits from <code>Throwable</code>.</p>
  
  <pre><code>catch(Exception exc) { /* won't catch RuntimeException */
  </code></pre>
  
  <p>but</p>
  
  <pre><code>catch(Throwable exc) { /* will catch RuntimeException */
  </code></pre>
  
  <p>I know <code>RuntimeException</code> is special in that it's unchecked. But to my understanding that applies just to whether exceptions have to be declared, not whether they are caught. And even then, I don't know why this logic would break on catching <code>Throwable</code>.</p>
  
  <p>This is pretty relevant to me since I have a situation where <code>RuntimeException</code> can be thrown in a terminal operation. I'm not sure the name for this pattern, but something like, my class <code>EmailRoller</code> takes an array of <code>Callbacks</code>. The code looks like this:</p>
  
  <pre><code>for(Callback cb : callbacks) {
      try {
          cb.call(item);
      }
      catch(Exception exc) {
          logger.error("Error in callback: ", exc);
     }
  }
  </code></pre>
  
  <p>So this is a case where something like an OOME needs to fly through, because if one of these callbacks consumes all machine memory, that sure as heck is going to affect the running of the other ones. But a <code>NullPointerException</code>? Or an <code>IndexOutOfBoundsException</code>? Those will affect the callback but won't prevent the others from running.</p>
  
  <p>Also, this is a bit of an enterprise design. Different programmers or teams can add callbacks to process the item, but they should be isolated from each other. This means, as the programmer responsible for insulating these callbacks from each other, I shouldn't rely on them to make sure errors don't slip through. Catching <code>Exception</code> should be about the right line, but it isn't because <code>RuntimeException</code> slips through. So my more general question is: what's a good pattern here? Just <code>catch(Exception | RuntimeException exc)</code>, which I believe is a syntax error because of the inheritance?</p>