I looked up for an answer on the internet but I could not really find what I was looking for.
I need to know what is wrong with the following code (provided we should avoid mixing callbacks and promises) -
function a(callback){
(async ()=>{
try{
let result = await doSomething();
callback(null, result);
} catch(e){
log('error at await');
callback(e, null);
}
})()
}
Is it ok if I use the above pattern in my code?