title: node.js: Throwing error and it's not being caught
body: <p>I have an API using swagger integrated with express on node.js and a resource defined as below. A swagger error thrown in the check for (!req.params.id), is caught by swagger's default error handler. An error thrown in the callback from the mongoDB delete call is NOT caught, giving me the error below. The error looks like it has to do with the scope/order of the callback function, and as somebody new to node.js I was hoping to get advice on how to do this properly, maintaining asynchronicity.   -thanks</p>
  
  <blockquote>
    <p>events.js:74
            throw TypeError('Uncaught, unspecified "error" event.');
                  ^ TypeError: Uncaught, unspecified "error" event.</p>
  </blockquote>
  
  <pre><code>exports.remove = {
      'spec' : {
        "collapsed...for...brevity..." : "...",
        "params" : [ {
          "paramType" : "path",
          "name" : "id",
          "collapsed...for...brevity..." : "...",
        }],
        "errorResponses" : [ swe.notFound('id'), swe.invalid('id') ],
        "nickname" : "remove"
      },
      'action' : function(req, res) {
  
        if (!req.params.id) {
          throw swe.invalid('id');   // THIS ERROR IS CAUGHT
        }
  
        req.coll.remove({_id : req.coll.id(req.params.id)}, function(e, result) {
          if (e) {
            throw swe.invalid('collection');   // THIS ERROR IS NOT CAUGHT
          }
  
          res.send({msg : 'success'});
        });
      }
    };
  </code></pre>