File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,9 @@ export default class SmartQuery extends SmartApollo {
143143
144144 const { data, loading, error, errors } = result
145145
146- if ( error || errors ) {
146+ const anyErrors = errors && errors . length
147+
148+ if ( error || anyErrors ) {
147149 this . firstRunReject ( )
148150 }
149151
@@ -154,7 +156,7 @@ export default class SmartQuery extends SmartApollo {
154156 // If `errorPolicy` is set to `all`, an error won't be thrown
155157 // Instead result will have an `errors` array of GraphQL Errors
156158 // so we need to reconstruct an error object similar to the normal one
157- if ( errors && errors . length ) {
159+ if ( anyErrors ) {
158160 const e = new Error ( `GraphQL error: ${ errors . map ( e => e . message ) . join ( ' | ' ) } ` )
159161 Object . assign ( e , {
160162 graphQLErrors : errors ,
@@ -165,7 +167,7 @@ export default class SmartQuery extends SmartApollo {
165167 super . catchError ( e )
166168 }
167169
168- if ( this . observer . options . errorPolicy === 'none' && ( error || errors ) ) {
170+ if ( this . observer . options . errorPolicy === 'none' && ( error || anyErrors ) ) {
169171 // Don't apply result
170172 return
171173 }
You can’t perform that action at this time.
0 commit comments