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:
committed by
Dan Poltawski
parent
ed52eb4c88
commit
5259c6b402
+7
-5
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js
Vendored
+6
-4
@@ -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;
|
||||
}
|
||||
|
||||
+7
-5
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user