title: Express.js next(err) not working
body: <p>Here's my code</p>
  
  <pre><code>mysql = require('mysql');
  con = mysql.createConnection(connectionSetttings);
  
  app.get('/users/list', ensureLogin, function (req, res, next) {
      con.query(query.getUserList, [req.user.innId], function (err, rows) {
          if (err) {
              next(err);  // also tried: return next(err)
          } else {
              displayUsers();
          }
      });
  }, function (err) {
      console.error(err);
      displayErrorPage(500);
  });
  </code></pre>
  
  <p>I run it with the MySQL server not running to see if Express would render the error page or not. The problem is, Express simply barfs up the stack into the browser. Is there anything wrong with my code? How do I properly chain middlewares?</p>