I've got the following:
var  http = require('http');
server = http.createServer(function(request, response) { 
  try {
    // Register a callback: this happens on a new stack on some later tick
    request.on('end', function() {
      throw new Error; // Not caught
    })
    throw new Error; // Caught below
  }
  catch (e) {
    // Handle logic
  }
}
Now, the first Error gets caught in the try...catch, but the second Error does not appear to be getting caught. 
A couple questions:
- Does the second Errornot get caught because it occurs on a different stack? If so, am I to understand thattry...catchbehavior is not lexically bound, but depends instead on the current stack? Am I interpreting this correctly?
- Are there any well-explored patterns to handle this type of problem?
 
     
     
    