Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary Promise.resolve and Promise.reject #3290

Merged
merged 1 commit into from Oct 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/execution/execute.ts
Expand Up @@ -368,7 +368,7 @@ function executeOperation(
if (isPromise(result)) {
return result.then(undefined, (error) => {
exeContext.errors.push(error);
return Promise.resolve(null);
return null;
});
}
return result;
Expand Down
7 changes: 4 additions & 3 deletions src/execution/mapAsyncIterator.ts
Expand Up @@ -43,9 +43,10 @@ export function mapAsyncIterator<T, U, R = undefined>(
: { value: undefined as any, done: true };
},
async throw(error?: unknown) {
return typeof iterator.throw === 'function'
? mapResult(await iterator.throw(error))
: Promise.reject(error);
if (typeof iterator.throw === 'function') {
return mapResult(await iterator.throw(error));
}
throw error;
},
[Symbol.asyncIterator]() {
return this;
Expand Down