constto=(promise:any)=>{if(!promise){returnnewPromise((resolve,reject)=>{reject(newError('requires promises as the param'))}).catch((err:Error)=>{return[err,null]})}returnpromise.then(function(){constarr=Array.from(arguments)return[null,...arr]}).catch((err:Error)=>{return[err,null]})}exportconstexec=async(sql:string)=>{const[err,res]=awaitto(db.exec(sql))if(err){thrownewError(err)}returnres}// ...async function const[data,err]=awaitto(getUsers())
Because you have to know, promsie comes with try/catch
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is too complicated, I usually do this
Because you have to know, promsie comes with try/catch