From: Timo Tijhof Date: Wed, 7 May 2014 17:58:56 +0000 (+0200) Subject: mediawiki.api: Don't log request error 'abort' X-Git-Tag: 1.31.0-rc.0~15832^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=173930cb32ba1a72a82474f927ec460b0baab834;p=lhc%2Fweb%2Fwiklou.git mediawiki.api: Don't log request error 'abort' Not really an error, but that's outside of our control. This change doesn't affect the actual Promise object. Callers will still get this through the error handler. If the request was aborted by the caller of mw.Api#ajax, there is no need to log this to the console. Only pollutes it with garbage. This was rather visible when browsing with debug=true and e.g. using search suggestions (and typing faster than requests are dispatched and completed). If a caller really wants to log this, they can easily do so from their error handler. Change-Id: I7797c833745b452109868675531f808c3d900534 --- diff --git a/resources/src/mediawiki.api/mediawiki.api.js b/resources/src/mediawiki.api/mediawiki.api.js index 9962534a9f..6444d93f2a 100644 --- a/resources/src/mediawiki.api/mediawiki.api.js +++ b/resources/src/mediawiki.api/mediawiki.api.js @@ -225,7 +225,9 @@ // Return the Promise return apiDeferred.promise( { abort: xhr.abort } ).fail( function ( code, details ) { - mw.log( 'mw.Api error: ', code, details ); + if ( code !== 'abort' ) { + mw.log( 'mw.Api error: ', code, details ); + } } ); },