2
ตำแหน่งของการจับก่อนและหลังนั้น
ฉันมีปัญหาในการทำความเข้าใจความแตกต่างระหว่างการใส่.catchก่อนและหลังในสัญญาซ้อนกัน ทางเลือกที่ 1: test1Async(10).then((res) => { return test2Async(22) .then((res) => { return test3Async(100); }).catch((err) => { throw "ERROR AFTER THEN"; }); }).then((res) => { console.log(res); }).catch((err) => { console.log(err); }); ทางเลือกที่ 2: test1Async(10).then((res) => { return test2Async(22) .catch((err) => { throw "ERROR BEFORE THEN"; }) .then((res) => { return test3Async(100); …