简体   繁体   English

从抛出错误NodeJS获取错误消息

[英]Get error message from a throw error NodeJS

I need to insert a log error in my db with the error. 我需要在数据库中插入一个带有错误的日志错误。

mysql.query(sql_log, [sucess], function (err, result) {
     if (err){ 
        mysql.rollback(function() {
           throw err;
        });
      }
});

I need get err.message 我需要得到err.message

just console.log(err); 只是console.log(err); after if condition. 如果条件后。

mysql.query(sql_log, [sucess], function (err, result) {
 if (err){ 
console.log(err);
    mysql.rollback(function() {
       throw err;
    });
  }});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM