Mongoose已经开始为我抛出错误,而不是将它们传递给我的回调?
var newsArticle = new NewsArticle(fields);
newsArticle.save(function(err, newsArticle) {
if(err) return next(err);
res.status(201).json(newsArticle);
});
永远不会调用回调,并抛出ValidationError,导致应用程序崩溃。这是为什么?
events.js:85
throw er; // Unhandled 'error' event
^
No listeners detected, throwing. Consider adding an error listener to your connection.
ValidationError: NewsArticle validation failed