Skip to content

Commit

Permalink
fix: check errors.length
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Nov 26, 2019
1 parent 1f15d60 commit 19482fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vue-apollo/src/smart-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 19482fa

Please sign in to comment.