From 19482fa199a9de25a40e91ad15e98225652acbb0 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Tue, 26 Nov 2019 16:07:15 +0100 Subject: [PATCH] fix: check errors.length --- packages/vue-apollo/src/smart-query.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-apollo/src/smart-query.js b/packages/vue-apollo/src/smart-query.js index 6d360ac..ce8afce 100644 --- a/packages/vue-apollo/src/smart-query.js +++ b/packages/vue-apollo/src/smart-query.js @@ -154,7 +154,7 @@ export default class SmartQuery extends SmartApollo { // If `errorPolicy` is set to `all`, an error won't be thrown // Instead result will have an `errors` array of GraphQL Errors // so we need to reconstruct an error object similar to the normal one - if (errors) { + if (errors && errors.length) { const e = new Error(`GraphQL error: ${errors.map(e => e.message).join(' | ')}`) Object.assign(e, { graphQLErrors: errors,