async function run(){ try{ await new Promise((resolve,reject)=>{ setTimeout(()=>{ let a = b.name },1000) }) }catch(e){ console.log(e) } } function test(){ try{ run() }catch(e){ console.log(e) } } // test()