1 | let AggregateErrorImpl;
|
2 | if (typeof AggregateError === 'undefined') {
|
3 | class AggregateErrorClass extends Error {
|
4 | constructor(errors, message = '') {
|
5 | super(message);
|
6 | this.errors = errors;
|
7 | this.name = 'AggregateError';
|
8 | Error.captureStackTrace(this, AggregateErrorClass);
|
9 | }
|
10 | }
|
11 | AggregateErrorImpl = function (errors, message) {
|
12 | return new AggregateErrorClass(errors, message);
|
13 | };
|
14 | }
|
15 | else {
|
16 | AggregateErrorImpl = AggregateError;
|
17 | }
|
18 | export { AggregateErrorImpl as AggregateError };
|
19 | export function isAggregateError(error) {
|
20 | return 'errors' in error && Array.isArray(error['errors']);
|
21 | }
|