fix: duplicate call to catchError, closes #1133
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user