Skip to content

Commit

Permalink
[sqllab] fix wrong error msg (#3849)
Browse files Browse the repository at this point in the history
I was getting some "Could not connect to server" when there was
a proper json payload with an `error` key, the change here makes sure to
prioritize those messages over the generic one.
  • Loading branch information
mistercrunch authored and Grace Guo committed Nov 13, 2017
1 parent 500455f commit 068c343
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions superset/assets/javascripts/SqlLab/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ export function runQuery(query) {
msg = err.responseText;
}
}
if (textStatus === 'error' && errorThrown === '') {
msg = t('Could not connect to server');
} else if (msg === null) {
msg = `[${textStatus}] ${errorThrown}`;
if (msg === null) {
if (errorThrown) {
msg = `[${textStatus}] ${errorThrown}`;
} else {
msg = t('Unknown error');
}
}
if (msg.indexOf('CSRF token') > 0) {
msg = t('Your session timed out, please refresh your page and try again.');
Expand Down

0 comments on commit 068c343

Please sign in to comment.