From 173930cb32ba1a72a82474f927ec460b0baab834 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 7 May 2014 19:58:56 +0200 Subject: [PATCH] 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 --- resources/src/mediawiki.api/mediawiki.api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ); + } } ); }, -- 2.20.1