Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dashboard] improve error handling on dashboard #2624

Merged
merged 3 commits into from
Apr 18, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions superset/assets/javascripts/modules/superset.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ const px = function () {
let msg = '';
if (!xhr.responseText) {
const status = xhr.status;
msg += 'An unknown error occurred. (Status: ' + status + ')';
if (status === 0) {
// This may happen when the worker in gunicorn times out
msg += ' Maybe the request timed out?';
msg += 'Could not reach server';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we give some sort of action here with the error message, like refreshing the page?

Sorry, the server could not be reached. Please refresh your page to try again.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server could not be reached. You may want to verify your connection and try again. ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want it to be too long though as it may repeat on all slices in the case of the dashboard view. It doesn't look nice to have a long error message shown in a bunch of places in the same view...

} else {
msg += 'An unknown error occurred. (Status: ' + status + ')';
}
}
return msg;
Expand All @@ -163,7 +164,9 @@ const px = function () {
} catch (e) {
// pass
}
errHtml = `<div class="alert alert-danger">${errorMsg}</div>`;
if (errorMsg) {
errHtml += `<div class="alert alert-danger">${errorMsg}</div>`;
}
if (xhr) {
const extendedMsg = this.getErrorMsg(xhr);
if (extendedMsg) {
Expand Down