mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
MDL-42989 JavaScript: Check result of navigation IO requests before reporting errors
When making a request which fails, we need to ensure that the AJAX query was not aborted before displaying the error. This ensures that if the navigation tree is being requested at the same time as a page load is being processed, the abortion of the AJAX request is not displayed before the page reloads.
This commit is contained in:
parent
ed52eb4c88
commit
5259c6b402
4 changed files with 21 additions and 15 deletions
|
@ -679,11 +679,13 @@ BRANCH.prototype = {
|
|||
}
|
||||
Y.log('AJAX loading complete but there were no children.', 'note', 'moodle-block_navigation');
|
||||
} catch (error) {
|
||||
// If we got here then there was an error parsing the result.
|
||||
Y.log('Error parsing AJAX response or adding branches to the navigation tree', 'error', 'moodle-block_navigation');
|
||||
Y.use('moodle-core-notification-exception', function () {
|
||||
return new M.core.exception(error).show();
|
||||
});
|
||||
if (outcome && outcome.status && outcome.status > 0) {
|
||||
// If we got here then there was an error parsing the result.
|
||||
Y.log('Error parsing AJAX response or adding branches to the navigation tree', 'error', 'moodle-block_navigation');
|
||||
Y.use('moodle-core-notification-exception', function () {
|
||||
return new M.core.exception(error).show();
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -675,10 +675,12 @@ BRANCH.prototype = {
|
|||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
// If we got here then there was an error parsing the result.
|
||||
Y.use('moodle-core-notification-exception', function () {
|
||||
return new M.core.exception(error).show();
|
||||
});
|
||||
if (outcome && outcome.status && outcome.status > 0) {
|
||||
// If we got here then there was an error parsing the result.
|
||||
Y.use('moodle-core-notification-exception', function () {
|
||||
return new M.core.exception(error).show();
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -677,11 +677,13 @@ BRANCH.prototype = {
|
|||
}
|
||||
Y.log('AJAX loading complete but there were no children.', 'note', 'moodle-block_navigation');
|
||||
} catch (error) {
|
||||
// If we got here then there was an error parsing the result.
|
||||
Y.log('Error parsing AJAX response or adding branches to the navigation tree', 'error', 'moodle-block_navigation');
|
||||
Y.use('moodle-core-notification-exception', function () {
|
||||
return new M.core.exception(error).show();
|
||||
});
|
||||
if (outcome && outcome.status && outcome.status > 0) {
|
||||
// If we got here then there was an error parsing the result.
|
||||
Y.log('Error parsing AJAX response or adding branches to the navigation tree', 'error', 'moodle-block_navigation');
|
||||
Y.use('moodle-core-notification-exception', function () {
|
||||
return new M.core.exception(error).show();
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue