From: Niklas Laxström Date: Tue, 22 Oct 2013 09:50:05 +0000 (+0000) Subject: mw.api.postWithToken now forwards promise on fail if we have token X-Git-Tag: 1.31.0-rc.0~18430^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=af628c514103163e2d8a75915140602d4c0130a7;p=lhc%2Fweb%2Fwiklou.git mw.api.postWithToken now forwards promise on fail if we have token Without this fix the callers of this function could not read the failure code and result, because we returned undefined. Because we are using a filter function, we need to explicitly return the promise to pass it forward. Change-Id: I71984ac827618459f723b0b9f47d4dc29e2a2f70 --- diff --git a/resources/mediawiki.api/mediawiki.api.js b/resources/mediawiki.api/mediawiki.api.js index f9a14b075d..cdc67679f4 100644 --- a/resources/mediawiki.api/mediawiki.api.js +++ b/resources/mediawiki.api/mediawiki.api.js @@ -206,6 +206,8 @@ tokenCache[tokenType] = params.token = undefined; return api.post( params ); } + // Pass the promise forward, so the caller gets error codes + return this; } ); } else {