Node.js Bluebird捕获错误日志语法?

Node.js Bluebird捕获错误日志语法?,node.js,error-handling,mongoose,promise,bluebird,Node.js,Error Handling,Mongoose,Promise,Bluebird,与此对应的Bluebird promise err日志记录是什么: if (err) { console.log(err); res.send(err); } 为此: }).catch(Promise.OperationalError, function(e){ // handle error in Mongoose save findOne etc, res.send(...) }).catch(function(e){ //

与此对应的Bluebird promise err日志记录是什么:

    if (err) {
        console.log(err);
        res.send(err);
    }
为此:

}).catch(Promise.OperationalError, function(e){
    // handle error in Mongoose save findOne etc, res.send(...)
}).catch(function(e){
    // handle other exceptions here, this is most likely
    // a 500 error where the top one is a 4XX, but pay close
    // attention to how you handle errors here
});

蓝鸟将自动为您记录未处理的拒绝。如果希望发送服务器对错误的响应并将链标记为已处理,可以执行以下操作:

.catch(function(err){
     console.log(err);
     res.send(err);
     throw err; // this is optional, if you don't want to mark the chain as handled.
 });

我很抱歉地看到了如何继续错误链来处理单独块中的日志记录。谢谢