Express.js 4 and domain module: why domain doesn't handle the error? Express.js 4 and domain module: why domain doesn't handle the error? express express

Express.js 4 and domain module: why domain doesn't handle the error?


The reason is that Express 4 is doing exception handling before your code with domain works, you can make sure that I am correct by adding following handler on bottom, it kinda wraps everything in try/catch and if there is no error handler prints error stack:

app.use(function (err, req, res, next) {   console.log(err);   res.end();});