AggregateError()
コンストラクタは、単一のエラーにラップする必要があるいくつかのエラーに対してエラーを作成します。
構文
new AggregateError(errors[, message])
値
errors
- エラーの反復可能であり、実際には
Error
インスタンスではない場合があります。 message
省略可- 集計エラーのオプションのヒューマンリーダブルの説明。
例
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" ]
}
仕様
ブラウザー実装状況
BCD tables only load in the browser