title: JavaScript errors not showing up in console?
body: <p><code>fields</code> is undefined in the following code snipped, but it is not logged to the console when the error happens. In this specific instance, why, and what is the de facto way to handle this?</p>
  
  <p><code>"Testing"</code> is logged to the console (Line #2), but the undefined variable <code>fields</code> (Line #4) is not being reported. The error is returned in an API response (Line #5) but with no relevant information such as line #, stack trace, etc.</p>
  
  <p>How can I make errors like this log to the console, and why are they not?</p>
  
  <pre><code>export function post(req, res) {
    console.log("Testing")
    User.create( getFields(req, ["name_first", "name_last"]) )
      .then(user =&gt;  respondJSON (res, fields, { status: 201 }))
      .catch(err =&gt; respondError (res, err))
  }
  </code></pre>
  
  <p>Since the catch is responding with an error, I get the following API response:</p>
  
  <pre><code>{
    "error": true,
    "data": {
      "message": "fields is not defined"
    }
  }
  </code></pre>
  
  <p>I am using Babel 6 and babel-node to run my code through NPM scripts. I am using morgan logging as well. Removing the middleware for logging does not alter the error output.</p>