I have tried:
app.get(\'/\', function(req, res, next) {
var e = new Error(\'error message\');
e.status = 400;
next(e);
});
and:
The version of the errorHandler middleware bundled with some (perhaps older?) versions of express seems to have the status code hardcoded. The version documented here: http://www.senchalabs.org/connect/errorHandler.html on the other hand lets you do what you are trying to do. So, perhaps trying upgrading to the latest version of express/connect.