Display import errors to user (#27147)
* Display import errors to user * Refactored * Refactored * Refactored * Fixed quality * Fixed quality * Refactored code * Fixed message * Refactored code
This commit is contained in:
@@ -240,7 +240,7 @@ define(
|
||||
*
|
||||
* @param {int} [stage=0] Starting stage.
|
||||
*/
|
||||
pollStatus: function(stage) {
|
||||
pollStatus: function(stage, message) {
|
||||
if (current.state !== STATE.IN_PROGRESS) {
|
||||
return;
|
||||
}
|
||||
@@ -250,13 +250,13 @@ define(
|
||||
if (current.stage === STAGE.SUCCESS) {
|
||||
success();
|
||||
} else if (current.stage < STAGE.UPLOADING) { // Failed
|
||||
error(gettext('Error importing course'));
|
||||
error(message || gettext('Error importing course'));
|
||||
} else { // In progress
|
||||
updateFeedbackList();
|
||||
|
||||
$.getJSON(file.url, function(data) {
|
||||
timeout.id = setTimeout(function() {
|
||||
this.pollStatus(data.ImportStatus);
|
||||
this.pollStatus(data.ImportStatus, data.Message);
|
||||
}.bind(this), timeout.delay);
|
||||
}.bind(this));
|
||||
}
|
||||
@@ -292,7 +292,7 @@ define(
|
||||
if (current.stage !== STAGE.UPLOADING) {
|
||||
current.state = STATE.IN_PROGRESS;
|
||||
|
||||
this.pollStatus(current.stage);
|
||||
this.pollStatus(current.stage, data.Message);
|
||||
} else {
|
||||
// An import in the upload stage cannot be resumed
|
||||
error(gettext('There was an error with the upload'));
|
||||
|
||||
Reference in New Issue
Block a user