Skip to content

Commit 1fd2859

Browse files
committed
Do not use .catch on Promises to supported a wider array of Promise libraries.
Fixes #478
1 parent 3142d87 commit 1fd2859

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/execution/execute.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export function execute(
153153
// resolved Promise.
154154
return new Promise(resolve => {
155155
resolve(executeOperation(context, context.operation, rootValue));
156-
}).catch(error => {
156+
}).then(undefined, error => {
157157
// Errors from sub-fields of a NonNull type may propagate to the top level,
158158
// at which point we still log the error and null the parent field, which
159159
// in this case is the entire response.
@@ -692,7 +692,8 @@ function completeValueWithLocatedError(
692692
result
693693
);
694694
if (isThenable(completed)) {
695-
return ((completed: any): Promise<*>).catch(
695+
return ((completed: any): Promise<*>).then(
696+
undefined,
696697
error => Promise.reject(locatedError(error, fieldASTs, path))
697698
);
698699
}

src/graphql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function graphql(
6666
)
6767
);
6868
}
69-
}).catch(error => {
69+
}).then(undefined, error => {
7070
return { errors: [ error ] };
7171
});
7272
}

0 commit comments

Comments
 (0)