Skip to content

Commit fcdeaf9

Browse files
committed
Remove unnecessary Promise.resolve and Promise.reject
1 parent bfc354e commit fcdeaf9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/execution/execute.ts

Lines changed: 1 addition & 1 deletion
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/subscription/mapAsyncIterator.ts

Lines changed: 4 additions & 3 deletions
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)