mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-29 05:42:20 +00:00
优化了 async 函数内部报错会导致 Promise 对象变为reject
状态的例子
原来的例子并不能很明显的表示打印的内容来自于 reject 的回调。
This commit is contained in:
parent
50b25c1a64
commit
c432253193
@ -184,10 +184,10 @@ async function f() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
f().then(
|
f().then(
|
||||||
v => console.log(v),
|
v => console.log(‘resolve’,v),
|
||||||
e => console.log(e)
|
e => console.log('reject',e)
|
||||||
)
|
)
|
||||||
// Error: 出错了
|
//reject Error: 出错了
|
||||||
```
|
```
|
||||||
|
|
||||||
### Promise 对象的状态变化
|
### Promise 对象的状态变化
|
||||||
|
Loading…
x
Reference in New Issue
Block a user