Fomafix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403210 )

Change subject: Use jQuery 3 .catch( fn ) instead of .then( null, fn )
......................................................................

Use jQuery 3 .catch( fn ) instead of .then( null, fn )

https://api.jquery.com/deferred.catch/ Since jQuery 3
deferred.catch( fn ) is an alias to deferred.then( null, fn )

This improves the readability.

Change-Id: I20fa3a1ed5c959ad0639ddf0162b8837fc15c720
---
M resources/src/mediawiki.special/mediawiki.special.apisandbox.js
M resources/src/mediawiki/api.js
M resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js
M resources/src/mediawiki/mediawiki.js
4 files changed, 5 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/10/403210/1

diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js 
b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
index ff4335a..534af05 100644
--- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
+++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
@@ -1112,7 +1112,7 @@
                                                return xhr;
                                        }
                                } )
-                                       .then( null, function ( code, data, 
result, jqXHR ) {
+                                       .catch( function ( code, data, result, 
jqXHR ) {
                                                var deferred = $.Deferred();
 
                                                if ( code !== 'http' ) {
diff --git a/resources/src/mediawiki/api.js b/resources/src/mediawiki/api.js
index 0e9c19b..2fcb4be 100644
--- a/resources/src/mediawiki/api.js
+++ b/resources/src/mediawiki/api.js
@@ -321,9 +321,7 @@
                                        return abortedPromise;
                                }
 
-                               return ( abortable = api.post( params, 
ajaxOptions ) ).then(
-                                       // If no error, return to caller as-is
-                                       null,
+                               return ( abortable = api.post( params, 
ajaxOptions ) ).catch(
                                        // Error handler
                                        function ( code ) {
                                                if ( code === 'badtoken' ) {
diff --git 
a/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js 
b/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js
index ac2bb02..2efacc9 100644
--- a/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js
+++ b/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js
@@ -113,8 +113,7 @@
                                        } )
                                );
                        }
-               ).then(
-                       null,
+               ).catch(
                        // Always resolve, never reject
                        function () { return $.Deferred().resolve(); }
                );
diff --git a/resources/src/mediawiki/mediawiki.js 
b/resources/src/mediawiki/mediawiki.js
index 6a218e3..104f699 100644
--- a/resources/src/mediawiki/mediawiki.js
+++ b/resources/src/mediawiki/mediawiki.js
@@ -2780,9 +2780,9 @@
                // We only need a callback, not any actual module. First try a 
single using()
                // for all loading modules. If one fails, fall back to tracking 
each module
                // separately via $.when(), this is expensive.
-               loading = mw.loader.using( modules ).then( null, function () {
+               loading = mw.loader.using( modules ).catch( function () {
                        var all = modules.map( function ( module ) {
-                               return mw.loader.using( module ).then( null, 
function () {
+                               return mw.loader.using( module ).catch( 
function () {
                                        return $.Deferred().resolve();
                                } );
                        } );

-- 
To view, visit https://gerrit.wikimedia.org/r/403210
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I20fa3a1ed5c959ad0639ddf0162b8837fc15c720
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Fomafix <foma...@googlemail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to