superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: add error details into log (#6169)
Date Thu, 25 Oct 2018 20:52:52 GMT
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 9c5fc42  add error details into log (#6169)
9c5fc42 is described below

commit 9c5fc42feeab4c4aabff994a3f2b00956384f672
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Thu Oct 25 13:52:47 2018 -0700

    add error details into log (#6169)
---
 .../spec/javascripts/chart/chartActions_spec.js    |  6 +++++
 superset/assets/src/chart/chartAction.js           | 26 +++++++++++++---------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/superset/assets/spec/javascripts/chart/chartActions_spec.js b/superset/assets/spec/javascripts/chart/chartActions_spec.js
index 21fbf90..4e2d634 100644
--- a/superset/assets/spec/javascripts/chart/chartActions_spec.js
+++ b/superset/assets/spec/javascripts/chart/chartActions_spec.js
@@ -79,6 +79,7 @@ describe('chart actions', () => {
       expect(dispatch.callCount).toBe(4);
       expect(fetchMock.calls(MOCK_URL)).toHaveLength(1);
       expect(dispatch.args[3][0].type).toBe(actions.CHART_UPDATE_SUCCEEDED);
+      expect(loggerStub.callCount).toBe(1);
 
       return Promise.resolve();
     });
@@ -95,6 +96,8 @@ describe('chart actions', () => {
       // chart update, trigger query, update form data, fail
       expect(dispatch.callCount).toBe(4);
       expect(dispatch.args[3][0].type).toBe(actions.CHART_UPDATE_TIMEOUT);
+      expect(loggerStub.callCount).toBe(1);
+      expect(loggerStub.args[0][1].error_details).toBe('timeout');
       setupDefaultFetchMock();
 
       return Promise.resolve();
@@ -113,6 +116,9 @@ describe('chart actions', () => {
       const updateFailedAction = dispatch.args[3][0];
       expect(updateFailedAction.type).toBe(actions.CHART_UPDATE_FAILED);
       expect(updateFailedAction.queryResponse.error).toBe('misc error');
+
+      expect(loggerStub.callCount).toBe(1);
+      expect(loggerStub.args[0][1].error_details).toBe('misc error');
       setupDefaultFetchMock();
 
       return Promise.resolve();
diff --git a/superset/assets/src/chart/chartAction.js b/superset/assets/src/chart/chartAction.js
index fb0f3da..38e4ad2 100644
--- a/superset/assets/src/chart/chartAction.js
+++ b/superset/assets/src/chart/chartAction.js
@@ -164,22 +164,28 @@ export function runQuery(formData, force = false, timeout = 60, key)
{
         return dispatch(chartUpdateSucceeded(json, key));
       })
       .catch((response) => {
-        Logger.append(LOG_ACTIONS_LOAD_CHART, {
-          slice_id: key,
-          has_err: true,
-          datasource: formData.datasource,
-          start_offset: logStart,
-          duration: Logger.getTimestamp() - logStart,
-        });
+        const appendErrorLog = (errorDetails) => {
+          Logger.append(LOG_ACTIONS_LOAD_CHART, {
+            slice_id: key,
+            has_err: true,
+            error_details: errorDetails,
+            datasource: formData.datasource,
+            start_offset: logStart,
+            duration: Logger.getTimestamp() - logStart,
+          });
+        };
 
         if (response.statusText === 'timeout') {
+          appendErrorLog('timeout');
           return dispatch(chartUpdateTimeout(response.statusText, timeout, key));
         } else if (response.name === 'AbortError') {
+          appendErrorLog('abort');
           return dispatch(chartUpdateStopped(key));
         }
-        return getClientErrorObject(response).then(parsedResponse =>
-          dispatch(chartUpdateFailed(parsedResponse, key)),
-        );
+        return getClientErrorObject(response).then((parsedResponse) => {
+          appendErrorLog(parsedResponse.error);
+          return dispatch(chartUpdateFailed(parsedResponse, key));
+        });
       });
 
     const annotationLayers = formData.annotation_layers || [];


Mime
View raw message