fix: check errors.length

This commit is contained in:
Guillaume Chau
2019-11-26 16:07:15 +01:00
parent 1f15d603ec
commit 19482fa199
+1 -1
View File
@@ -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,