michael-s-molina commented on code in PR #23377:
URL: https://github.com/apache/superset/pull/23377#discussion_r1140226028


##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -267,6 +269,33 @@ export function queryFailed(query, msg, link, errors) {
           })
         : Promise.resolve();
 
+    const eventData = {
+      has_err: true,
+      start_offset: query.startDttm,
+      ts: new Date().getTime(),
+    };
+    errors?.forEach(({ error_type: errorType, extra }) => {
+      if (extra?.issue_codes) {
+        extra?.issue_codes.forEach(({ message }) => {
+          dispatch(
+            logEvent(LOG_ACTIONS_SQLLAB_FETCH_QUERY, {
+              ...eventData,
+              error_type: errorType,
+              error_details: message,
+            }),
+          );
+        });
+      } else {
+        dispatch(
+          logEvent(LOG_ACTIONS_SQLLAB_FETCH_QUERY, {
+            ...eventData,
+            error_type: errorType,
+            error_details: errorType,
+          }),
+        );
+      }
+    });

Review Comment:
   ```suggestion
       errors?.forEach(({ error_type: errorType, extra }) => {
         const messages = extra?.issue_codes.map(code => code.message) || 
[errorType];
         messages.forEach(message => {
           dispatch(
             logEvent(LOG_ACTIONS_SQLLAB_FETCH_QUERY, {
               ...eventData,
               error_type: errorType,
               error_details: message,
             }),
           );
         });
       });
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to