title: How can I catch errors thrown by my jsdom.jqueryify callback?
body: <p>The output of this code when run in node.js is the stack trace of an error that occurs on the last line (line number 9). The error that occurs on line 7 is somehow 'absorbed' by node. Even if I wrap it in a try/catch statement I can't seem to get as detailed a stack trace output as I do from node's default error handling code.</p>
  
  <p>How can I catch the error on line 7 and get as much detail about it as I can from line 9?</p>
  
  <pre><code>jsdom = require('jsdom');
  var testHTML = "&lt;html&gt;&lt;head&gt;&lt;title&gt;Hi!&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Hi!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;";
  jsdom.jQueryify(
      jsdom.jsdom(testHTML).createWindow(),
      'http://code.jquery.com/jquery-1.4.2.min.js' ,
      function() {
          var a = broken();
      });
  var a = broken();
  </code></pre>
  
  <p>(NB: This is a simplified example from a much more complex script I'm writing with errors that occur in a 'deeply' nested stack that forms as a result of a call from within a jQueryify call-back, and debugging it is an <em>absolute</em> pain right now without being able to get detailed stats on the error)</p>