Skip to content

Commit

Permalink
docs(promise): edit AggregateError
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanyf committed Jun 7, 2022
1 parent b5fa350 commit e0772de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/promise.md
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ try {

上面代码中,`Promise.any()`方法的参数数组包含三个 Promise 操作。其中只要有一个变成`fulfilled``Promise.any()`返回的 Promise 对象就变成`fulfilled`。如果所有三个操作都变成`rejected`,那么`await`命令就会抛出错误。

`Promise.any()`抛出的错误是一个 AggregateError 实例(详见《对象的扩展》一章),里面包含了所有成员的错误
`Promise.any()`抛出的错误是一个 AggregateError 实例(详见《对象的扩展》一章),这个 AggregateError 实例对象的`errors`属性是一个数组,包含了所有成员的错误

下面是一个例子。

Expand Down

0 comments on commit e0772de

Please sign in to comment.