Get error message from a throw error NodeJS

88 Views Asked by At

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

1

There are 1 best solutions below

1
Abhi Anand On

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;
    });
  }});