You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:33)
25
25
Error: bar
26
26
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
27
+
Error: baz
28
+
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
27
29
at AggregateError (/Users/sindresorhus/dev/aggregate-error/index.js:19:3)
28
30
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
29
31
at Module._compile (module.js:556:32)
@@ -41,18 +43,22 @@ for (const el of err) {
41
43
}
42
44
//=> [Error: foo]
43
45
//=> [Error: bar]
46
+
//=> [Error: baz]
44
47
```
45
48
46
49
47
50
## API
48
51
49
52
### AggregateError(errors)
50
53
51
-
Returns an `Error` that is also an [`iterator`](https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Iterators_and_Generators) for the individual errors.
54
+
Returns an `Error` that is also an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables) for the individual errors.
52
55
53
56
#### errors
54
57
55
-
Type: `Iterable<Error|string>`
58
+
Type: `Iterable<Error|Object|string>`
59
+
60
+
If a string, a new `Error` is created with the string as the error message.<br>
61
+
If a non-Error object, a new `Error` is created with all properties from the object copied over.
0 commit comments