aggregate-error
Create an error from multiple errors
Install
$ npm install aggregate-error
Usage
const AggregateError = require('aggregate-error');
const error = new AggregateError([new Error('foo'), 'bar', {message: 'baz'}]);
throw error;
for (const individualError of error) {
console.log(individualError);
}
API
AggregateError(errors)
Returns an Error
that is also an Iterable
for the individual errors.
errors
Type: Array<Error|Object|string>
If a string, a new Error
is created with the string as the error message.
If a non-Error object, a new Error
is created with all properties from the object copied over.