jenkins-bot has submitted this change and it was merged.

Change subject: mw.Target: Use saveError's third parameter for response data
......................................................................


mw.Target: Use saveError's third parameter for response data

This parameter was documented as "HTTP status text" but this
was incorrectly copied from other events. The actual code
never passed anything other than null.

Now documenting it as API response data (if available, else null)

Change-Id: I88c8c525f3ca53fd47de634aec469be372884cfc
---
M modules/ve/init/mw/ve.init.mw.Target.js
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/init/mw/ve.init.mw.Target.js 
b/modules/ve/init/mw/ve.init.mw.Target.js
index c764ddf..8cf07fe 100644
--- a/modules/ve/init/mw/ve.init.mw.Target.js
+++ b/modules/ve/init/mw/ve.init.mw.Target.js
@@ -97,7 +97,7 @@
  * @event saveError
  * @param {jqXHR|null} jqXHR
  * @param {string} status Text status message
- * @param {Mixed|null} error HTTP status text
+ * @param {Object|null} data API response data
  */
 
 /**
@@ -323,7 +323,8 @@
                        );
                }
        } else if ( data.result !== 'success' ) {
-               ve.init.mw.Target.onSaveError.call( this, null, 'Failed 
request: ' + data.result, null );
+               // Note, this could be any of db failure, hookabort, badtoken 
or even a captcha
+               ve.init.mw.Target.onSaveError.call( this, null, 'Save failure', 
data );
        } else if ( typeof data.content !== 'string' ) {
                ve.init.mw.Target.onSaveError.call(
                        this, null, 'Invalid HTML content in response from 
server', null
@@ -342,12 +343,12 @@
  * @this ve.init.mw.Target
  * @param {Object} jqXHR
  * @param {string} status Text status message
- * @param {Mixed} error HTTP status text
+ * @param {Object|null} data API response data
  * @emits saveError
  */
-ve.init.mw.Target.onSaveError = function ( jqXHR, status, error ) {
+ve.init.mw.Target.onSaveError = function ( jqXHR, status, data ) {
        this.saving = false;
-       this.emit( 'saveError', jqXHR, status, error );
+       this.emit( 'saveError', jqXHR, status, data );
 };
 
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I88c8c525f3ca53fd47de634aec469be372884cfc
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to