Standard built-ins

AggregateError()

Try the free JavaScript compiler

Creates an Error holding an array of values collected from an iterable. The values need not be Error objects.

Formal Syntax & Structure

javascript syntaxjavascript
new AggregateError(errors, [message], [options])

Parameters & Attributes

NameTypeDescription
errorsIterableValues representing individual failures.
messageStringDiagnostic message.
optionsObjectOptional cause property.

Return Value

AggregateError

Error with errors array.

Working Example

Example Snippetjavascript
console.log(new AggregateError([new Error("a"), new Error("b")],"failed").errors.length);
JavaScript Reference