Permalink
Browse files

fix(js): don't show ajax error message when aborting request

If the error is due to calling `xhr.abort` (not an HTTP error, timeout,
or parse error), we don't show a message to the user.

Fixes #9372
  • Loading branch information...
mrclay committed Feb 11, 2016
1 parent 7ea15f7 commit 5aea301f901be1a2c5984264f8ecf19a2138c45c
Showing with 4 additions and 4 deletions.
  1. +4 −4 js/lib/ajax.js
View
@@ -81,9 +81,7 @@ elgg.ajax.handleOptions = function(url, options) {
if (!elgg.isFunction(options.error)) {
// add a generic error handler
- options.error = function(xhr, status, error) {
- elgg.ajax.handleAjaxError(xhr, status, error);
- };
+ options.error = elgg.ajax.handleAjaxError;
}
if (url) {
@@ -102,7 +100,9 @@ elgg.ajax.handleOptions = function(url, options) {
* @private
*/
elgg.ajax.handleAjaxError = function(xhr, status, error) {
- elgg.register_error(elgg.echo('ajax:error'));
+ if (status !== 'abort') {
+ elgg.register_error(elgg.echo('ajax:error'));
+ }
};
/**

0 comments on commit 5aea301

Please sign in to comment.