Skip to content

Commit 2272f98

Browse files
Remove unnecessary Promise.resolve and Promise.reject (#3290)
1 parent 239aa33 commit 2272f98

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/execution/execute.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ function executeOperation(
368368
if (isPromise(result)) {
369369
return result.then(undefined, (error) => {
370370
exeContext.errors.push(error);
371-
return Promise.resolve(null);
371+
return null;
372372
});
373373
}
374374
return result;

src/execution/mapAsyncIterator.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ export function mapAsyncIterator<T, U, R = undefined>(
4343
: { value: undefined as any, done: true };
4444
},
4545
async throw(error?: unknown) {
46-
return typeof iterator.throw === 'function'
47-
? mapResult(await iterator.throw(error))
48-
: Promise.reject(error);
46+
if (typeof iterator.throw === 'function') {
47+
return mapResult(await iterator.throw(error));
48+
}
49+
throw error;
4950
},
5051
[Symbol.asyncIterator]() {
5152
return this;

0 commit comments

Comments
 (0)