JS Built-ins
AggregateErrorbeginner

AggregateError β€” also an Error

πŸ“– Usage Example
Promise.any([Promise.reject(new Error('e1')), Promise.reject(new Error('e2'))])
  .catch(e => e instanceof AggregateError)  // β†’ true

Promise.any() rejects with an AggregateError when all promises reject.

AggregateError extends Error

AggregateError extends the built-in Error class.

Challenge: Verify that an AggregateError is also an instance of Error.

πŸ’‘ Hints (1)
  • β€’ AggregateError inherits from Error in the prototype chain.