简体   繁体   中英

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

just console.log(err); after if condition.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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