【发布时间】:2015-02-25 07:22:02
【问题描述】:
在并行中间件的“pre”中验证猫鼬模式时
schema.pre('save', true, function (next, done) {
if(...) {
next(new Error('Some error message'));
}
next();
});
我返回一个错误,它在回调函数中可用:
model.save({},{}, function(err) {
res.json(400, err);
console.log(err)// I see in the console: [Error: 'Some error message']
})
但是当我这样做时
res.json(400, err);
我得到一个空响应
{} No properties
这是什么原因?
【问题讨论】: