UNPKG

670 BJavaScriptView Raw
1let AggregateErrorImpl;
2if (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}
15else {
16 AggregateErrorImpl = AggregateError;
17}
18export { AggregateErrorImpl as AggregateError };
19export function isAggregateError(error) {
20 return 'errors' in error && Array.isArray(error['errors']);
21}