title: Functional Java - Interaction between whenComplete and exceptionally
body: <p>In this code:</p>
  
  <pre><code>doSomethingThatMightThrowAnException()
    .whenComplete((result, ex) -&gt; doSomethingElse()})
    .exceptionally(ex -&gt; handleException(ex));
  </code></pre>
  
  <p>When there is an exception from <code>doSomethingThatMightThrowAnException</code>, are both <code>doSomethingElse</code> and <code>handleException</code> run, or is the exception consumed by either the <code>whenComplete</code> or the <code>exceptionally</code>?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p><code>doSomethingThatMightThrowAnException</code> returns a <code>CompletableFuture</code>, which might <code>completeExceptionally</code>. This is the exception I'm talking about.</p>