//回调函数 doSomeThing(result => { doSomeThingElse(result, newResult => { doSomeThingThird(newResult, finalResult => { console.log(finalResult) }, errCallback) }, errCallback) }, errCallback) // promise嵌套 doSomeThing() .then(result => { return doSomeThingElse(result) }) .then(newResult => { return doSomeThingThird(newResult) }) .then(finalResult => { console.log(finalResult) }) .catch(err => { console.log(err); }) //异常穿透,只需要指定一个catch async function request() { try { const result = await doSomeThing() const newResult = await doSomeThingElse(result) const finalResult = await doSomeThingThird(newResult) console.log('finalResult: ', finalResult); } catch (error) { //异常穿透 errCallback(error) } } let errCallback = error => { console.log(error) }