AggregateError: errors

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

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

Property attributes of AggregateError: errors
Writable 가능
Enumerable 불가능
Configurable 가능

예제

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 Language Specification
# sec-aggregate-error

브라우저 호환성

BCD tables only load in the browser

같이 보기