fix: duplicate call to catchError, closes #1133

This commit is contained in:
Guillaume Chau
2021-11-28 18:49:58 +01:00
parent 60347d30a0
commit eaf1da7c39
3 changed files with 3 additions and 3 deletions
@@ -15,7 +15,7 @@ function query (errorPolicy) {
console.log(errorPolicy, result)
},
error (error) {
console.log(error)
console.log('Error', errorPolicy, error)
this.errors[errorPolicy] = error
},
}
@@ -8,7 +8,7 @@ describe('errorPolicy', () => {
// None
cy.get('.none .result').should('not.contain', 'good').should('not.contain', 'bad')
cy.get('.none .error').should('contain', 'Error: GraphQL error: An error')
cy.get('.none .error').should('contain', 'Error: An error')
// Ignore
cy.get('.ignore .result').should('contain', '"good":"good"').should('contain', '"bad":null}')
@@ -175,7 +175,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 (anyErrors) {
if (!error && anyErrors) {
const e = new Error(`GraphQL error: ${errors.map(e => e.message).join(' | ')}`)
Object.assign(e, {
graphQLErrors: errors,