process.on('unhandledRejection', function (err) {
console.log('Caught exception: ', err);
});
let go = async () => {
throw new Error('Inner Error')
}
go();
var a;
con.query("SELECT count(*) FROM `users` ...", function(error, results, fields){
if (error) throw error;
console.log(results.length); // количество совпадений
a = results.length;
if(a ...) // number records
...
});