title: Express/Node.JS middleware raising error, keeps processing
body: <p>I'm beginning under NodeJS/Express and I'm facing the following problem (I probably didn't get all the tricks of async programming yet)</p>
  
  <p>I've made a middleware in charge of checking if a oauth_token paramters is passed (actually implementing oAuth layer on my node server)</p>
  
  <p>I'm doing this :</p>
  
  <pre><code>function myMiddle(req,res,next) {
    var oAuthToken = req.query["oauth_token"];
    if (oAuthToken == undefined) {
              res.send(406);
              res.end();
      next(new Error('No token provided'));   
  }
  /* Basically doing some DB stuff with MongoDB, connecting and using oAuthToken provided to query, etc.. */
  </code></pre>
  
  <p>The thing is that I expected the code to "die" when he doesn't receive the oauth_token parameters in the query string. It's actually raising me an error and returning greatly 406 error to my HTTP client, but code keeps processing behind and raises me mutable headers errors caused by my processing code after, and my script dies.</p>
  
  <p>Something I'm missing? Thanks by advance.</p>