title: Promise reject "... not defined", how do I find the source
body: <p>My application has many modules and uses promises all over the place.</p>
  
  <p>On occasion, deep in one of these modules, my code throws an exception
  and the promise chain gets rejected.  If this error was reproducible,
  I could single step until I found the exception. But it's not.</p>
  
  <p>How do I get nodejs to generate a traceback to identify the guilty module, function and line of code?</p>
  
  <p>Here is a trivial example.</p>
  
  <pre><code>'use strict';
  
  // pretend multiple modules, each with deep complicated chains of Promises 
  Promise.resolve()
     .then(() =&gt; { return Promise.resolve() })
     .then(() =&gt; { return Promise.resolve() })
     .then(() =&gt; { return Promise.resolve() })
     .then(() =&gt; {
         x = "find me if you can, x is very common variable name";
         return Promise.resolve
     })
     .then(() =&gt; { return Promise.resolve() })
     .then(() =&gt; { return Promise.resolve() })
     .catch((e) =&gt; { console.log("where did you come from " + e) })
  </code></pre>
  
  <p>The output from the above is "where did you come from ReferenceError: x is not defined"</p>