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 {
143
143
144
144
const { data, loading, error, errors } = result
145
145
146
- if ( error || errors ) {
146
+ const anyErrors = errors && errors . length
147
+
148
+ if ( error || anyErrors ) {
147
149
this . firstRunReject ( )
148
150
}
149
151
@@ -154,7 +156,7 @@ export default class SmartQuery extends SmartApollo {
154
156
// If `errorPolicy` is set to `all`, an error won't be thrown
155
157
// Instead result will have an `errors` array of GraphQL Errors
156
158
// so we need to reconstruct an error object similar to the normal one
157
- if ( errors && errors . length ) {
159
+ if ( anyErrors ) {
158
160
const e = new Error ( `GraphQL error: ${ errors . map ( e => e . message ) . join ( ' | ' ) } ` )
159
161
Object . assign ( e , {
160
162
graphQLErrors : errors ,
@@ -165,7 +167,7 @@ export default class SmartQuery extends SmartApollo {
165
167
super . catchError ( e )
166
168
}
167
169
168
- if ( this . observer . options . errorPolicy === 'none' && ( error || errors ) ) {
170
+ if ( this . observer . options . errorPolicy === 'none' && ( error || anyErrors ) ) {
169
171
// Don't apply result
170
172
return
171
173
}
You can’t perform that action at this time.
0 commit comments