I am trying to create a method for a synchronous query. I'm using pg-pool and asyncawait, but I throw the following error: "Error: await functions, yield functions, and value-returning suspendable functions may only be called from within a suspendable function."
The code is:
CustomPool = function(condigDB){
this.pool = new Pool(cofigDB)
};
CustomPool.prototype.querySync = function(sql){
var result = {rows:[]};
try{
result = await(this.pool.query(sql));
}
catch(_e_){
Log.exception(_e_);
}
return result.rows;
};
module.exports = CustomPool;
I am trying to create a method for a synchronous query. I'm using pg-pool and asyncawait, but I throw the following error: "Error: await functions, yield functions, and value-returning suspendable functions may only be called from within a suspendable function."
The code is: