AggregateError
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since â¨2020ë 9ìâ©.
* Some parts of this feature may have varying levels of support.
AggregateError ê°ì²´ë ë¤ìì ì¤ë¥ê° í ì¤ë¥ë¡ í¬ì¥ëì´ì¼ í ëì ì¤ë¥ë¥¼ ëíë
ëë¤.
í ìì
ìì ì¬ë¬ ê°ì ì¤ë¥ê° ë³´ê³ ë ë ë°ìíëë°, ëíì ì¼ë¡ Promise.any()ì ì ë¬ë 모ë
íë¡ë¯¸ì¤ê° ê±°ë¶ëìì ë ë°ìí©ëë¤.
AggregateErrorì Errorì íì í´ëì¤ ì
ëë¤.
ìì±ì
AggregateError()-
ìë¡ì´
AggregateErrorê°ì²´ë¥¼ ìì±í©ëë¤.
ì¸ì¤í´ì¤ ìì±
ì¸ì¤í´ì¤ ìì±ì ë¶ëª¨ì¸ Errorë¡ë¶í° ììë°ìµëë¤.
ìë ìì±ì AggregateError.prototypeì ì ìëì´ ìì¼ë©° 모ë ì¸ì¤í´ì¤ ê°ì²´ì ê³µì í©ëë¤.
AggregateError.prototype.constructor-
ì¸ì¤í´ì¤ ê°ì²´ë¥¼ ìì±íë ìì±ì í¨ìì ëë¤.
AggregateErrorì¸ì¤í´ì¤ìì ì´ê¸° ê°ìAggregateErrorìì±ìì ëë¤. AggregateError.prototype.name-
ì¤ë¥ì ì íì ëí ì´ë¦ì ëíë ëë¤.
AggregateError.prototype.nameì ì´ê¸° ê°ì"AggregateError"ì ëë¤.
ìë ìì±ì AggregateError ì¸ì¤í´ì¤ì ìì²´ ìì±ì
ëë¤.
errors-
ì§ê³ë ì¤ë¥ë¥¼ ëíë´ë ë°°ì´ì ëë¤.
ì¸ì¤í´ì¤ ë©ìë
ì¸ì¤í´ì¤ ë©ìëë ë¶ëª¨ì¸ Errorë¡ë¶í° ììë°ìµëë¤.
ìì
>AggregateError ì²ë¦¬í기
Promise.any([Promise.reject(new Error("some error"))]).catch((e) => {
console.log(e instanceof AggregateError); // true
console.log(e.message); // "All Promises rejected"
console.log(e.name); // "AggregateError"
console.log(e.errors); // [ Error: "some error" ]
});
AggregateError ë°ììí¤ê¸°
try {
throw new AggregateError([new Error("some error")], "Hello");
} catch (e) {
console.log(e instanceof AggregateError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "AggregateError"
console.log(e.errors); // [ Error: "some error" ]
}
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2026 Language Specification > # sec-aggregate-error-objects > |