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

AggregateError: errors

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월⁩.

AggregateError 인스턴스의 errors 데이터 속성에는 집계된 오류를 나타내는 배열이 포함되어 있습니다.

Array이며, AggregateError() 생성자의 첫 번째 인자로 전달된 반복과 동일한 순서의 값을 가지고 있습니다.

Property attributes of AggregateError: errors
쓰기 가능가능
열거 가능불가능
설정 가능가능

예제

errors 사용하기

js
try {
  throw new AggregateError(
    // An iterable of errors
    new Set([new Error("some error"), new Error("another error")]),
    "Multiple errors thrown",
  );
} catch (err) {
  console.log(err.errors);
  // [
  //   Error: some error,
  //   Error: another error
  // ]
}

명세서

Specification
ECMAScript® 2026 Language Specification
# sec-aggregate-error

브라우저 호환성

같이 보기