williaster commented on a change in pull request #6276: [superset-client] 
`getClientErrorObject` for everyone
URL: 
https://github.com/apache/incubator-superset/pull/6276#discussion_r230904381
 
 

 ##########
 File path: superset/assets/src/chart/chartAction.js
 ##########
 @@ -101,15 +101,16 @@ export function runAnnotationQuery(annotation, timeout = 
60, formData = null, ke
       timeout: timeout * 1000,
     })
       .then(({ json }) => dispatch(annotationQuerySuccess(annotation, json, 
sliceKey)))
-      .catch((err) => {
+      .catch(response => getClientErrorObject(response).then((err) => {
         if (err.statusText === 'timeout') {
           dispatch(annotationQueryFailed(annotation, { error: 'Query Timeout' 
}, sliceKey));
-        } else if ((err.responseJSON.error || '').toLowerCase().includes('no 
data')) {
+        } else if ((err.error || '').toLowerCase().includes('no data')) {
           dispatch(annotationQuerySuccess(annotation, err, sliceKey));
         } else if (err.statusText !== 'abort') {
-          dispatch(annotationQueryFailed(annotation, err.responseJSON, 
sliceKey));
+          dispatch(annotationQueryFailed(annotation, err, sliceKey));
 
 Review comment:
   I checked that `err.error` is pulled from `err` in the 
`annotationQueryFailed` reducer

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to