SOURCE

function getSomeThing(){
    return new Promise((resolve, reject)=>{
        setTimeout(()=>{
            // resolve("success")
            reject("fail")
        }, 1000)
    })
}

async function test(){
    try {
        const res = await getSomeThing()
        console.log(res)
    }catch (e) {
        console.log(e)
    }finally {
        console.log("finally")
    }

}

// 这种写法很臃肿
// test().catch((reason)=>{
//     console.log(reason)
// })
test()
console 命令行工具 X clear

                    
>
console