title: How to catch promise runtime Javascript errors?
body: <p>I'm currently implementing a PDF viewer based on PDF.js and as part of that I learned about promise objects.</p>
  
  <p>I also learned that runtime errors are not automatically shown in the debugging console:</p>
  
  <pre><code>PDFJS.getDocument(...).then(
    function(pdfDocument){
      alert(UndefinedVariable); // Not shown in console!
    },
    function(error){
      console.log("Error occurred", error);
    }
  );
  </code></pre>
  
  <p>I haven't been able to find a pretty way to show runtime errors in the promise functions, other than adding <code>.done()</code> as described in <a href="http://www.asyncdev.net/2013/07/promises-errors-and-express-js/" rel="noreferrer">http://www.asyncdev.net/2013/07/promises-errors-and-express-js/</a> (which doesn't work for PDF.js) or adding <code>.catch(function(error){ console.error(error); })</code>.</p>
  
  <p>I know that I can break on exceptions from runtime errors in the debugger, but I also get breaks on other exceptions (in jQuery) by doing so, which means I have to step thorugh 5 jQuery exceptions on every page load, before I can even check if my own code contains runtime errors.</p>
  
  <p>Is there any way to force the promise functions to log runtime errors like normal (without writing extra code for every function call)?</p>