MDN self-hosted library · e01.org

AggregateError: errors

The errors data property of an AggregateError instance contains an array representing the errors that were aggregated.

Open notebook · 1 cells javascript-instance-data-property upstream source

The errors data property of an AggregateError instance contains an array representing the errors that were aggregated.

Value

An Array containing values in the same order as the iterable passed as the first argument of the AggregateError() constructor.

0

Examples

Using errors

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
  // ]
}

Specifications

Browser compatibility

See also