Skip to content

Commit 18c0975

Browse files
committed
Use AggregateError if available
1 parent b6b68d0 commit 18c0975

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export function toe<TData extends Record<string, any>>(result: {
1717
"Invalid call to graphql-toe; neither data nor errors were present",
1818
);
1919
} else {
20-
throw errors[0];
20+
throw typeof AggregateError === "undefined"
21+
? errors[0]
22+
: new AggregateError(errors, errors[0].message);
2123
}
2224
}
2325
if (!errors || errors.length === 0) {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "@tsconfig/recommended/tsconfig.json",
33
"compilerOptions": {
4+
"lib": ["es2021"],
45
"declaration": true,
56
"rootDir": "src",
67
"declarationDir": "./dist",

0 commit comments

Comments
 (0)