AggregateError() constructor
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2020.
AggregateError()
생성자는 AggregateError
객체를 생성합니다.
구문
js
new AggregateError(errors)
new AggregateError(errors, message)
new AggregateError(errors, message, options)
AggregateError(errors)
AggregateError(errors, message)
AggregateError(errors, message, options)
참고: AggregateError()
는 new
와 함께 혹은 없이도 호출할 수 있습니다. 두 방법 모두 AggregateError
인스턴스를 생성합니다.
매개변수
예제
AggregateError 생성하기
js
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 Language Specification # sec-aggregate-error-constructor |
브라우저 호환성
BCD tables only load in the browser