title: Node.js program exits even though uncaught exceptions are handled
body: <p>I wrote the following code for handling uncaught exceptions in my application (I know this is a rather naive error handling appraoch, the code is just for the purpose of the question):</p>
  
  <pre><code>process.on("uncaughtException", err =&gt; {
      console.log('Handling exception');
  });
  
  console.log('starting...');
  
  function f() {
      throw(new Error('Error'));
  }
  
  f();
  console.log('Done');
  </code></pre>
  
  <p>When I ran the code, I got the following output:</p>
  
  <pre><code>starting...
  Handling exception
  </code></pre>
  
  <p>For some reason, even though the exception was handled, the program exited without running the last line of code.
  When I wrapped the call to <code>f()</code> with a <code>try-catch</code> block, the last line executed and the word 'Done' was printed to the screen.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Is this the expected behaviour?</li>
  <li>Why is there a difference between these two mechanisms (listening to the event and using try-catch)?</li>
  </ol>