我不明白为什么 expressjs 在抛出 async.waterfall 时不处理错误
var express = require('express')
, app = express.createServer()
, async = require('async');
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
app.get('/error', function(req, res){
throw Error('Aie');
});
app.get('/asyncerror', function(req, res){
var that = this;
async.waterfall([
function(next){
console.log('1');
next("42", "2");
},
function(arg, next) {
console.log(arg);
res.json('ok');
}
], function(err){
console.log(this);
throw Error('Aie');
});
});
app.listen(8888, function(){
console.log('Listen on 0.0.0.0:8888');
});
当我 GET /error 时,expressjs 打印一个不错的错误而没有崩溃服务器但是当我 GET /asyncerror 这是一个经典的抛出,打印在 stdout 上并出现服务器崩溃..
谢谢你的帮助。