From 72bca8ed68dd4889aa844e24458e29038a796ca7 Mon Sep 17 00:00:00 2001 From: Michiel ter Reehorst Date: Tue, 22 Nov 2016 16:21:56 +0100 Subject: [PATCH] Catch `fetchQuery` errors in `startQuery`. Fixes https://github.com/apollostack/apollo-client/issues/891 The error wasn't caught anywhere. Should anything be done with the error? For subscriptions it is handled via the store I believe. --- src/core/QueryManager.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index 58ba6c10430..11354a09837 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -638,7 +638,10 @@ export class QueryManager { public startQuery(queryId: string, options: WatchQueryOptions, listener: QueryListener) { this.addQueryListener(queryId, listener); - this.fetchQuery(queryId, options); + this.fetchQuery(queryId, options) + // `fetchQuery` returns a Promise. In case of a failure it should be caucht or else the + // console will show an `Uncaught (in promise)` message. + .catch((error: Error) => {}); return queryId; }