HTML: Markup language
CSS: Styling language
JavaScript: Scripting language
Web APIs: Programming interfaces
All web technology
Learn web development
Discover our tools
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
View in English Always switch to English
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
Promise.any()
AggregateError은 Error의 하위 클래스 입니다.
Error
AggregateError()
새로운AggregateError 객체를 생성합니다.
인스턴스 속성은 부모인 Error로부터 상속받습니다.
아래 속성은 AggregateError.prototype에 정의되어 있으며 모든 인스턴스 객체와 공유합니다.
AggregateError.prototype
AggregateError.prototype.constructor
인스턴스 객체를 생성하는 생성자 함수입니다. AggregateError 인스턴스에서 초기 값은 AggregateError 생성자입니다.
AggregateError.prototype.name
오류의 유형에 대한 이름을 나타냅니다. AggregateError.prototype.name의 초기 값은 "AggregateError"입니다.
"AggregateError"
아래 속성은 AggregateError 인스턴스의 자체 속성입니다.
errors
집계된 오류를 나타내는 배열입니다.
인스턴스 메서드는 부모인 Error로부터 상속받습니다.
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" ] });
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" ] }
Enable JavaScript to view this browser compatibility table.
core-js
Promise.any